public class CheckoutCommand extends GitCommand<Ref>
repo
Modifier | Constructor and Description |
---|---|
protected |
CheckoutCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
CheckoutCommand |
addPath(java.lang.String path) |
Ref |
call()
Executes the command
|
protected CheckoutCommand |
checkoutPaths()
Checkout paths into index and working directory
|
CheckoutResult |
getResult() |
CheckoutCommand |
setAllPaths(boolean all)
Set whether to checkout all paths
|
CheckoutCommand |
setCreateBranch(boolean createBranch) |
CheckoutCommand |
setForce(boolean force) |
CheckoutCommand |
setName(java.lang.String name) |
CheckoutCommand |
setStartPoint(RevCommit startCommit) |
CheckoutCommand |
setStartPoint(java.lang.String startPoint) |
CheckoutCommand |
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode) |
checkCallable, getRepository, setCallable
protected CheckoutCommand(Repository repo)
repo
- public Ref call() throws GitAPIException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, CheckoutConflictException
GitCommand
call
in interface java.util.concurrent.Callable<Ref>
call
in class GitCommand<Ref>
RefAlreadyExistsException
- when trying to create (without force) a branch with a name
that already existsRefNotFoundException
- if the start point or branch can not be foundInvalidRefNameException
- if the provided name is null
or otherwise
invalidCheckoutConflictException
- if the checkout results in a conflictGitAPIException
- or subclass thereof when an error occurspublic CheckoutCommand addPath(java.lang.String path)
path
- Path to update in the working tree and index.this
public CheckoutCommand setAllPaths(boolean all)
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.
all
- true to checkout all paths, false otherwisethis
protected CheckoutCommand checkoutPaths() throws java.io.IOException, RefNotFoundException
java.io.IOException
RefNotFoundException
public CheckoutCommand setName(java.lang.String name)
name
- the name of the new branchpublic CheckoutCommand setCreateBranch(boolean createBranch)
createBranch
- if true
a branch will be created as part of the
checkout and set to the specified start pointpublic CheckoutCommand setForce(boolean force)
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 changedpublic CheckoutCommand setStartPoint(java.lang.String startPoint)
startPoint
- corresponds to the start-point option; if null
,
the current HEAD will be usedpublic CheckoutCommand setStartPoint(RevCommit startCommit)
startCommit
- corresponds to the start-point option; if null
,
the current HEAD will be usedpublic CheckoutCommand setUpstreamMode(CreateBranchCommand.SetupUpstreamMode mode)
mode
- corresponds to the --track/--no-track options; may be
null
public CheckoutResult getResult()
Copyright © 2012. All Rights Reserved.