public class PushCommand extends TransportCommand<PushCommand,Iterable<PushResult>>
Push
command. It has setters for all
supported options and arguments of this command and a call()
method
to finally execute the command.credentialsProvider, timeout, transportConfigCallback
repo
Modifier | Constructor and Description |
---|---|
protected |
PushCommand(Repository repo)
Constructor for PushCommand.
|
Modifier and Type | Method and Description |
---|---|
PushCommand |
add(Ref ref)
Add a reference to push.
|
PushCommand |
add(String nameOrSpec)
Add a reference to push.
|
Iterable<PushResult> |
call() |
ProgressMonitor |
getProgressMonitor()
Get the progress monitor
|
List<String> |
getPushOptions()
Get push options
|
String |
getReceivePack()
Get the name of the remote executable providing the receive-pack service
|
List<RefLeaseSpec> |
getRefLeaseSpecs()
Get the
RefLeaseSpec s. |
List<RefSpec> |
getRefSpecs()
Get
RefSpec s. |
String |
getRemote()
Get remote name
|
int |
getTimeout()
Get timeout used for push operation
|
boolean |
isAtomic()
Whether this push should be executed atomically (all references updated,
or none)
|
boolean |
isDryRun()
Whether to run the push operation as a dry run
|
boolean |
isForce()
Whether to push forcefully
|
boolean |
isThin()
Get the thin-pack preference
|
PushCommand |
setAtomic(boolean atomic)
Requests atomic push (all references updated, or no updates).
|
PushCommand |
setDryRun(boolean dryRun)
Sets whether the push operation should be a dry run
|
PushCommand |
setForce(boolean force)
Sets the force preference for push operation.
|
PushCommand |
setOutputStream(OutputStream out)
Sets the output stream to write sideband messages to
|
PushCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the push operation.
|
PushCommand |
setPushAll()
Push all branches under refs/heads/*.
|
PushCommand |
setPushOptions(List<String> pushOptions)
Set the option strings associated with the push operation.
|
PushCommand |
setPushTags()
Push all tags under refs/tags/*.
|
PushCommand |
setReceivePack(String receivePack)
The remote executable providing receive-pack service for pack transports.
|
PushCommand |
setRefLeaseSpecs(List<RefLeaseSpec> specs)
The ref lease specs to be used in the push operation, for a
force-with-lease push operation.
|
PushCommand |
setRefLeaseSpecs(RefLeaseSpec... specs)
The ref lease specs to be used in the push operation, for a
force-with-lease push operation.
|
PushCommand |
setRefSpecs(List<RefSpec> specs)
The ref specs to be used in the push operation
|
PushCommand |
setRefSpecs(RefSpec... specs)
The ref specs to be used in the push operation
|
PushCommand |
setRemote(String remote)
The remote (uri or name) used for the push operation.
|
PushCommand |
setThin(boolean thin)
Set the thin-pack preference for push operation.
|
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
checkCallable, getRepository, setCallable
protected PushCommand(Repository repo)
Constructor for PushCommand.
repo
- the Repository
public Iterable<PushResult> call() throws GitAPIException, InvalidRemoteException, TransportException
Execute the command
Execute the push
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 (means: one
call to call()
)
call
in interface Callable<Iterable<PushResult>>
call
in class GitCommand<Iterable<PushResult>>
GitAPIException
InvalidRemoteException
TransportException
public PushCommand setRemote(String remote)
Constants.DEFAULT_REMOTE_NAME
will
be used.remote
- the remote namethis
Constants.DEFAULT_REMOTE_NAME
public String getRemote()
public PushCommand setReceivePack(String receivePack)
RemoteConfig.DEFAULT_RECEIVE_PACK
will be used.receivePack
- name of the remote executable providing the receive-pack
servicethis
RemoteConfig.DEFAULT_RECEIVE_PACK
public String getReceivePack()
public int getTimeout()
public ProgressMonitor getProgressMonitor()
public PushCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitor
monitor
- a ProgressMonitor
this
NullProgressMonitor
public List<RefLeaseSpec> getRefLeaseSpecs()
RefLeaseSpec
s.RefLeaseSpec
spublic PushCommand setRefLeaseSpecs(RefLeaseSpec... specs)
specs
- a RefLeaseSpec
object.this
public PushCommand setRefLeaseSpecs(List<RefLeaseSpec> specs)
specs
- list of RefLeaseSpec
sthis
public PushCommand setRefSpecs(RefSpec... specs)
specs
- a RefSpec
object.this
public PushCommand setRefSpecs(List<RefSpec> specs)
specs
- list of RefSpec
sthis
public PushCommand setPushAll()
public PushCommand setPushTags()
public PushCommand add(Ref ref)
ref
- the source reference. The remote name will match.this
.public PushCommand add(String nameOrSpec)
nameOrSpec
- any reference name, or a reference specification.this
.JGitInternalException
- the reference name cannot be resolved.public boolean isDryRun()
public PushCommand setDryRun(boolean dryRun)
dryRun
- a boolean.this
public boolean isThin()
public PushCommand setThin(boolean thin)
thin
- the thin-pack preference valuethis
public boolean isAtomic()
public PushCommand setAtomic(boolean atomic)
atomic
- whether to run the push atomicallythis
public boolean isForce()
public PushCommand setForce(boolean force)
force
- whether to push forcefullythis
public PushCommand setOutputStream(OutputStream out)
out
- an OutputStream
this
public List<String> getPushOptions()
public PushCommand setPushOptions(List<String> pushOptions)
pushOptions
- a List
of push option stringsthis
Copyright © 2019 Eclipse JGit Project. All rights reserved.