@Signature public Memory branchCreate(String name, ArrayMemory settings) throws GitAPIException { CreateBranchCommand command = getWrappedObject().branchCreate(); command.setName(name); if (settings != null && settings.isNotNull()) { Memory startPoint = settings.valueOfIndex("startPoint"); if (startPoint.isNotNull()) { command.setStartPoint(startPoint.toString()); } command.setForce(settings.valueOfIndex("force").toBoolean()); Memory upstreamMode = settings.valueOfIndex("upstreamMode"); if (upstreamMode.isNotNull()) { command.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.valueOf(upstreamMode.toString())); } } return GitUtils.valueOf(command.call()); }
.setForce(true) .call();
.setForce(true) .call();
public Ref createBranch(Git git, String branchName) throws GitAPIException { return git.branchCreate() .setName(branchName) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint("origin/" + branchName) .setForce(true) .call(); }
.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + localBranch) .setForce(true) .call(); } catch (Throwable t) { .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remote.getK1() + "/" + branch) .setForce(true) .call(); } catch (Throwable t) {
@Override public Void call() { try { git.branchCreate() .setName(branchName) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint("origin/" + branchName) .setForce(true) .call(); git.checkout().setName(branchName).call(); } catch (final GitAPIException e) { LOGGER.error("Unable to create/checkout branch " + branchName, e); } return null; } });
@Override public Void call() { try { git.branchCreate() .setName(branchName) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint("origin/" + branchName) .setForce(true) .call(); git.checkout().setName(branchName).call(); } catch (final GitAPIException e) { LOGGER.error("Unable to create/checkout branch " + branchName, e); } return null; } });
.setUpstreamMode( CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM ) .setStartPoint( "upstream/master" ) .setForce( true ) .call();
private void overrideBranchNames(final Repository repository, final RevWalk revWalk, final Map<ObjectId, ObjectId> commitMap) throws AmbiguousObjectException, IncorrectObjectTypeException, IOException, MissingObjectException, GitAPIException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException { for (String branchName : branches) { if (branchName.equals("HEAD")) { continue; } final ObjectId oldBranchTipId = repository.resolve(branchName); final ObjectId newBranchTipId = closestMappedAncestorOrSelf(commitMap, revWalk.parseCommit(oldBranchTipId))[0]; final RevCommit newBranchTip = revWalk.parseCommit(newBranchTipId); org.eclipse.jgit.api.Git.wrap(repository) .branchCreate() .setName(branchName) .setForce(true) .setStartPoint(newBranchTip) .setUpstreamMode(SetupUpstreamMode.NOTRACK) .call(); } }
private void updateBranch(final String targetBranchName, final org.eclipse.jgit.api.Git git, final ObjectId commitId) throws Exception { git.branchCreate() .setName(targetBranchName) .setStartPoint(commitId.name()) .setForce(true) .call(); }
private void updateBranch(final String targetBranchName, final org.eclipse.jgit.api.Git git, final ObjectId commitId) throws Exception { git.branchCreate() .setName(targetBranchName) .setStartPoint(commitId.name()) .setForce(true) .call(); }
public void checkoutFromRemote(String remoteBranchName, String branchName) throws GitAPIException, JGitInternalException, StopTaskException { mRepo.getGit().checkout().setCreateBranch(true).setName(branchName) .setStartPoint(remoteBranchName).call(); mRepo.getGit() .branchCreate() .setUpstreamMode( CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remoteBranchName).setName(branchName) .setForce(true).call(); } }
public void checkoutFromRemote(String remoteBranchName, String branchName) throws GitAPIException, JGitInternalException, StopTaskException { mRepo.getGit().checkout().setCreateBranch(true).setName(branchName) .setStartPoint(remoteBranchName).call(); mRepo.getGit() .branchCreate() .setUpstreamMode( CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM) .setStartPoint(remoteBranchName).setName(branchName) .setForce(true).call(); } }
git.branchCreate().setName(SRCDEPS_WORKING_BRANCH).setForce(true).setStartPoint(startPoint).call(); git.checkout().setName(SRCDEPS_WORKING_BRANCH).call(); git.reset().setMode(ResetType.HARD).setRef(startPoint).call();