org.eclipse.jgit.api
Class CheckoutCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<Ref>
org.eclipse.jgit.api.CheckoutCommand
- All Implemented Interfaces:
- Callable<Ref>
public class CheckoutCommand
- extends GitCommand<Ref>
Checkout a branch to the working tree
- See Also:
- Git documentation about Checkout
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CheckoutCommand
protected CheckoutCommand(Repository repo)
- Parameters:
repo
-
call
public Ref call()
throws JGitInternalException,
RefAlreadyExistsException,
RefNotFoundException,
InvalidRefNameException
- Returns:
- the newly created branch
- Throws:
RefAlreadyExistsException
- when trying to create (without force) a branch with a name
that already exists
RefNotFoundException
- if the start point or branch can not be found
InvalidRefNameException
- if the provided name is null
or otherwise
invalid
JGitInternalException
addPath
public CheckoutCommand addPath(String path)
- Parameters:
path
- Path to update in the working tree and index.
- Returns:
this
checkoutPaths
protected CheckoutCommand checkoutPaths()
throws IOException,
RefNotFoundException
- Checkout paths into index and working directory
- Returns:
- this instance
- Throws:
IOException
RefNotFoundException
setName
public CheckoutCommand setName(String name)
- Parameters:
name
- the name of the new branch
- Returns:
- this instance
setCreateBranch
public CheckoutCommand setCreateBranch(boolean createBranch)
- Parameters:
createBranch
- if true
a branch will be created as part of the
checkout and set to the specified start point
- Returns:
- this instance
setForce
public CheckoutCommand setForce(boolean force)
- Parameters:
force
- if true
and the branch with the given name
already exists, the start-point of an existing branch will be
set to a new start-point; if false, the existing branch will
not be changed
- Returns:
- this instance
setStartPoint
public CheckoutCommand setStartPoint(String startPoint)
- Parameters:
startPoint
- corresponds to the start-point option; if null
,
the current HEAD will be used
- Returns:
- this instance
setStartPoint
public CheckoutCommand setStartPoint(RevCommit startCommit)
- Parameters:
startCommit
- corresponds to the start-point option; if null
,
the current HEAD will be used
- Returns:
- this instance
setUpstreamMode
public CheckoutCommand setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode)
- Parameters:
mode
- corresponds to the --track/--no-track options; may be
null
- Returns:
- this instance
getResult
public CheckoutResult getResult()
- Returns:
- the result
Copyright © 2011. All Rights Reserved.