@Signature public Memory branchRename(String newName, Memory oldName) throws GitAPIException { RenameBranchCommand command = getWrappedObject().branchRename(); command.setNewName(newName); if (oldName.isNotNull()) { command.setOldName(oldName.toString()); } return GitUtils.valueOf(command.call()); }
public static void renameBranches(Path repositoryDirectory, Map<String, String> branchOldNameToNewName) { Git git = null; try { git = Git.open(repositoryDirectory.toFile()); for (Map.Entry<String, String> entry : branchOldNameToNewName.entrySet()) { String oldBranchName = entry.getKey(); String newBranchName = entry.getValue(); if (branchExistsLocally(git, oldBranchName)) { git.branchRename().setOldName(oldBranchName).setNewName(newBranchName).call(); } } } catch (IOException | GitAPIException e) { throw new GitException("Unable to rename all branches", e); } finally { close(git); } }
String newRefName = refPrefix + labelDialog.getValue(); try { new Git(repo).branchRename().setOldName(refName) .setNewName(labelDialog.getValue()).call(); branchTree.refresh();
String newRefName = refPrefix + labelDialog.getValue(); try { new Git(repo).branchRename().setOldName(refName).setNewName( labelDialog.getValue()).call(); branchTree.refresh();
FetchResult fetchResult = git.fetch().setTimeout(gitTimeout).setCredentialsProvider(credentialsProvider).setRemote(remoteRef).setRefSpecs(new RefSpec("refs/heads/" + branch)).call(); Ref fetchRef = fetchResult.getAdvertisedRef("refs/heads/" + branch); git.branchRename().setOldName(branch).setNewName(branch + "-tmp").call(); git.checkout().setCreateBranch(true).setName(branch).setStartPoint(fetchRef.getObjectId().getName()).call(); git.branchDelete().setBranchNames(branch + "-tmp").setForce(true).call();
deleteBranchCommand.call(); log.debug(String.format("Finalize git re-branch=%s for repository=%s", localBranch, git.getRepository().getDirectory())); RenameBranchCommand renameBranchCommand = git.branchRename(); renameBranchCommand.setOldName(tmpBranchName); renameBranchCommand.setNewName(localBranch);
switch (commitType) { case Repo.COMMIT_TYPE_HEAD: mRepo.getGit().branchRename() .setOldName(mFromCommit) .setNewName(newBranchname)
switch (commitType) { case Repo.COMMIT_TYPE_HEAD: mRepo.getGit().branchRename() .setOldName(mFromCommit) .setNewName(newBranchname)
FetchResult fetchResult = git.fetch().setTimeout(gitTimeout).setCredentialsProvider(credentialsProvider).setRemote(remoteRef).setRefSpecs(new RefSpec("refs/heads/" + branch)).call(); Ref fetchRef = fetchResult.getAdvertisedRef("refs/heads/" + branch); git.branchRename().setOldName(branch).setNewName(branch + "-tmp").call(); git.checkout().setCreateBranch(true).setName(branch).setStartPoint(fetchRef.getObjectId().getName()).call(); git.branchDelete().setBranchNames(branch + "-tmp").setForce(true).call();