List of usage examples for org.eclipse.jgit.api CheckoutCommand setStage
public CheckoutCommand setStage(Stage stage)
From source file:org.archicontribs.modelrepository.grafico.MergeConflictHandler.java
License:Open Source License
private void checkout(Git git, Stage stage, List<String> paths) throws IOException, GitAPIException { CheckoutCommand checkoutCommand = git.checkout(); checkoutCommand.setStage(stage); checkoutCommand.addPaths(paths);//from w ww .j a va 2 s . c om checkoutCommand.call(); }
From source file:org.jplus.jenkins.plugin.git.GITRepositoryUtils.java
@Override public void update() { try {/*from w ww. j a va2 s . c o m*/ LOGGER.debug("update git:" + repositoryPath); CheckoutCommand checkout = git.checkout(); ObjectId resolve = repo.resolve("master"); if (resolve == null) { checkout.setCreateBranch(true); } checkout.setForce(true); checkout.setStage(CheckoutCommand.Stage.THEIRS); checkout.setName("master"); checkout.call(); ResetCommand reset = git.reset(); reset.setMode(ResetCommand.ResetType.HARD); reset.setRef("HEAD"); reset.call(); PullCommand pull = git.pull(); pull.setRebase(true); pull.setRemote("origin"); pull.setRemoteBranchName("master"); pull.setStrategy(MergeStrategy.THEIRS); pull.call(); } catch (Exception ex) { Logger.getLogger(GITRepositoryUtils.class.getName()).log(Level.SEVERE, "update git:" + repositoryPath + " error!!!", ex); } }