org.eclipse.jgit.api
Class RenameBranchCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<Ref>
org.eclipse.jgit.api.RenameBranchCommand
- All Implemented Interfaces:
- Callable<Ref>
public class RenameBranchCommand
- extends GitCommand<Ref>
Used to rename branches.
- See Also:
- Git documentation about Branch
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RenameBranchCommand
protected RenameBranchCommand(Repository repo)
- Parameters:
repo
-
call
public Ref call()
throws GitAPIException,
RefNotFoundException,
InvalidRefNameException,
RefAlreadyExistsException,
DetachedHeadException
- Description copied from class:
GitCommand
- Executes the command
- Specified by:
call
in interface Callable<Ref>
- Specified by:
call
in class GitCommand<Ref>
- Returns:
- T a result. Each command has its own return type
- Throws:
RefNotFoundException
- if the old branch can not be found (branch with provided old
name does not exist or old name resolves to a tag)
InvalidRefNameException
- if the provided new name is null
or otherwise
invalid
RefAlreadyExistsException
- if a branch with the new name already exists
DetachedHeadException
- if rename is tried without specifying the old name and HEAD
is detached
GitAPIException
- or subclass thereof when an error occurs
setNewName
public RenameBranchCommand setNewName(String newName)
- Parameters:
newName
- the new name
- Returns:
- this instance
setOldName
public RenameBranchCommand setOldName(String oldName)
- Parameters:
oldName
- the name of the branch to rename; if not set, the currently
checked out branch (if any) will be renamed
- Returns:
- this instance
Copyright © 2012. All Rights Reserved.