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 GitAPIException,
RefAlreadyExistsException,
RefNotFoundException,
InvalidRefNameException,
CheckoutConflictException
- Description copied from class:
GitCommand
- Executes the command
- Specified by:
call
in interface Callable<Ref>
- Specified by:
call
in class GitCommand<Ref>
- 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
CheckoutConflictException
- if the checkout results in a conflict
GitAPIException
- or subclass thereof when an error occurs
addPath
public CheckoutCommand addPath(String path)
- Parameters:
path
- Path to update in the working tree and index.
- Returns:
this
setAllPaths
public CheckoutCommand setAllPaths(boolean all)
- Set whether to checkout all paths
This options should be used when you want to do a path checkout on the
entire repository and so calling addPath(String)
is not possible
since empty paths are not allowed.
- Parameters:
all
- true to checkout all paths, false otherwise
- Returns:
this
- Since:
- 2.0
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 © 2012. All Rights Reserved.