Package org.eclipse.jgit.transport
Class PushProcess
java.lang.Object
org.eclipse.jgit.transport.PushProcess
Class performing push operation on remote repository.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PushConnectionPush operation connection created to perform this operationprivate final OutputStreaman outputstream to write messages toprivate final PrePushHook(package private) static final StringTask name forProgressMonitorused during opening connection.A list of option strings associated with this pushprivate final Map<String,RemoteRefUpdate> Refs to update on remote side.private final TransportTransport used to perform this operation.private final RevWalkRevision walker for checking some updates properties. -
Constructor Summary
ConstructorsConstructorDescriptionPushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush) Create process for specified transport and refs updates specification.PushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush, OutputStream out) Create process for specified transport and refs updates specification. -
Method Summary
Modifier and TypeMethodDescription(package private) PushResultexecute(ProgressMonitor monitor) Perform push operation between local and remote repository - set remote refs appropriately, send needed objects and update local tracking refs.private Map<String,RemoteRefUpdate> Expands all placeholderRemoteRefUpdates for "matching"RefSpecs ":" intoPushand returns the resulting map in which the placeholders have been replaced by their expansion.private voidexpandMatching(Map<String, RemoteRefUpdate> updates, RemoteRefUpdate match) Expands the placeholderRemoteRefUpdatematchfor a "matching"RefSpec":" or "+:" and puts the expansion into the given mapupdates.Gets the list of option strings associated with this push.private booleanisFastForward(ObjectId oldOid, ObjectId newOid) Determines whether an update fromoldOidtonewOidis a fast-forward update: both old and new must be commits, AND both of them must be known to us and exist in the repository, AND the old commit must be an ancestor of the new commit.private voidprivate Map<String,RemoteRefUpdate> private Map<String,RemoteRefUpdate> private void
-
Field Details
-
PROGRESS_OPENING_CONNECTION
Task name forProgressMonitorused during opening connection. -
transport
Transport used to perform this operation. -
connection
Push operation connection created to perform this operation -
toPush
Refs to update on remote side. -
walker
Revision walker for checking some updates properties. -
out
an outputstream to write messages to -
pushOptions
A list of option strings associated with this push -
prePush
-
-
Constructor Details
-
PushProcess
PushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush) throws TransportException Create process for specified transport and refs updates specification.- Parameters:
transport- transport between remote and local repository, used to create connection.toPush- specification of refs updates (and local tracking branches).prePush-PrePushHookto run after the remote advertisement has been gotten- Throws:
TransportException
-
PushProcess
PushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush, OutputStream out) throws TransportException Create process for specified transport and refs updates specification.- Parameters:
transport- transport between remote and local repository, used to create connection.toPush- specification of refs updates (and local tracking branches).prePush-PrePushHookto run after the remote advertisement has been gottenout- OutputStream to write messages to- Throws:
TransportException
-
-
Method Details
-
execute
Perform push operation between local and remote repository - set remote refs appropriately, send needed objects and update local tracking refs.When
Transport.isDryRun()is true, result of this operation is just estimation of real operation result, no real action is performed.- Parameters:
monitor- progress monitor used for feedback about operation.- Returns:
- result of push operation with complete status description.
- Throws:
NotSupportedException- when push operation is not supported by provided transport.TransportException- when some error occurred during operation, like I/O, protocol error, or local database consistency error.
-
prepareRemoteUpdates
- Throws:
TransportException
-
isFastForward
Determines whether an update fromoldOidtonewOidis a fast-forward update:- both old and new must be commits, AND
- both of them must be known to us and exist in the repository, AND
- the old commit must be an ancestor of the new commit.
- Parameters:
oldOid-ObjectIdof the old commitnewOid-ObjectIdof the new commit- Returns:
trueif the update fast-forwards,falseotherwise- Throws:
TransportException
-
expandMatching
Expands all placeholderRemoteRefUpdates for "matching"RefSpecs ":" intoPushand returns the resulting map in which the placeholders have been replaced by their expansion.- Returns:
- a new map of
RemoteRefUpdates keyed by remote name - Throws:
TransportException- if the expansion results in duplicate updates
-
expandMatching
private void expandMatching(Map<String, RemoteRefUpdate> updates, RemoteRefUpdate match) throws TransportExceptionExpands the placeholderRemoteRefUpdatematchfor a "matching"RefSpec":" or "+:" and puts the expansion into the given mapupdates.- Parameters:
updates- map to put the expansion inmatch- the placeholderRemoteRefUpdateto expand- Throws:
TransportException- if the expansion results in duplicate updates, or the local branches cannot be determined
-
rejectAll
-
modifyUpdatesForDryRun
private void modifyUpdatesForDryRun() -
updateTrackingRefs
private void updateTrackingRefs() -
getPushOptions
Gets the list of option strings associated with this push.- Returns:
- pushOptions
- Since:
- 4.5
-