public class RebaseCommand extends GitCommand<RebaseResult>
Rebase
command. It has setters for all
supported options and arguments of this command and a call()
method
to finally execute the command. Each instance of this class should only be
used for one invocation of the command (means: one call to call()
)
Modifier and Type | Class and Description |
---|---|
static interface |
RebaseCommand.InteractiveHandler
Allows configure rebase interactive process and modify commit message
|
static class |
RebaseCommand.Operation
The available operations
|
Modifier and Type | Field and Description |
---|---|
static String |
REBASE_MERGE
The name of the "rebase-merge" folder for interactive rebases.
|
static String |
STOPPED_SHA
The name of the "stopped-sha" file
|
repo
Modifier | Constructor and Description |
---|---|
protected |
RebaseCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
RebaseResult |
call()
Executes the
Rebase command with all the options and parameters
collected by the setter methods of this class. |
RebaseCommand |
runInteractively(RebaseCommand.InteractiveHandler handler)
Enables interactive rebase
|
RebaseCommand |
runInteractively(RebaseCommand.InteractiveHandler handler,
boolean stopAfterRebaseInteractiveInitialization)
Enables interactive rebase
|
RebaseCommand |
setOperation(RebaseCommand.Operation operation) |
RebaseCommand |
setPreserveMerges(boolean preserve) |
RebaseCommand |
setProgressMonitor(ProgressMonitor monitor) |
RebaseCommand |
setStrategy(MergeStrategy strategy) |
RebaseCommand |
setUpstream(AnyObjectId upstream) |
RebaseCommand |
setUpstream(RevCommit upstream) |
RebaseCommand |
setUpstream(String upstream) |
RebaseCommand |
setUpstreamName(String upstreamName)
Optionally override the name of the upstream.
|
RevCommit |
tryFastForward(RevCommit newCommit)
checks if we can fast-forward and returns the new head if it is possible
|
checkCallable, getRepository, setCallable
public static final String REBASE_MERGE
public static final String STOPPED_SHA
protected RebaseCommand(Repository repo)
repo
- public RebaseResult call() throws GitAPIException, NoHeadException, RefNotFoundException, WrongRepositoryStateException
Rebase
command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command. Don't call
this method twice on an instance.call
in interface Callable<RebaseResult>
call
in class GitCommand<RebaseResult>
GitAPIException
WrongRepositoryStateException
NoHeadException
RefNotFoundException
public RevCommit tryFastForward(RevCommit newCommit) throws IOException, GitAPIException
newCommit
- IOException
GitAPIException
public RebaseCommand setUpstream(RevCommit upstream)
upstream
- the upstream committhis
public RebaseCommand setUpstream(AnyObjectId upstream)
upstream
- id of the upstream committhis
public RebaseCommand setUpstream(String upstream) throws RefNotFoundException
upstream
- the upstream branchthis
RefNotFoundException
public RebaseCommand setUpstreamName(String upstreamName)
setUpstream(org.eclipse.jgit.revwalk.RevCommit)
call.upstreamName
- the name which will be used to refer to upstream in conflictsthis
public RebaseCommand setOperation(RebaseCommand.Operation operation)
operation
- the operation to performthis
public RebaseCommand setProgressMonitor(ProgressMonitor monitor)
monitor
- a progress monitorpublic RebaseCommand runInteractively(RebaseCommand.InteractiveHandler handler)
Does not stop after initialization of interactive rebase. This is
equivalent to
runInteractively(handler, false)
;
handler
- public RebaseCommand runInteractively(RebaseCommand.InteractiveHandler handler, boolean stopAfterRebaseInteractiveInitialization)
If stopAfterRebaseInteractiveInitialization is true
the rebase
stops after initialization of interactive rebase returning
RebaseResult.INTERACTIVE_PREPARED_RESULT
handler
- stopAfterRebaseInteractiveInitialization
- if true
the rebase stops after initializationpublic RebaseCommand setStrategy(MergeStrategy strategy)
strategy
- The merge strategy to use during this rebase operation.this
public RebaseCommand setPreserveMerges(boolean preserve)
preserve
- True to re-create merges during rebase. Defaults to false, a
flattening rebase.this
Copyright © 2018 Eclipse JGit Project. All rights reserved.