Package org.eclipse.jgit.transport
Class PushProcess
- java.lang.Object
-
- org.eclipse.jgit.transport.PushProcess
-
class PushProcess extends java.lang.ObjectClass performing push operation on remote repository.
-
-
Field Summary
Fields Modifier and Type Field Description private PushConnectionconnectionPush operation connection created to perform this operationprivate java.io.OutputStreamoutan outputstream to write messages toprivate PrePushHookprePush(package private) static java.lang.StringPROGRESS_OPENING_CONNECTIONTask name forProgressMonitorused during opening connection.private java.util.List<java.lang.String>pushOptionsA list of option strings associated with this pushprivate java.util.Map<java.lang.String,RemoteRefUpdate>toPushRefs to update on remote side.private TransporttransportTransport used to perform this operation.private RevWalkwalkerRevision walker for checking some updates properties.
-
Constructor Summary
Constructors Constructor Description PushProcess(Transport transport, java.util.Collection<RemoteRefUpdate> toPush, PrePushHook prePush)Create process for specified transport and refs updates specification.PushProcess(Transport transport, java.util.Collection<RemoteRefUpdate> toPush, PrePushHook prePush, java.io.OutputStream out)Create process for specified transport and refs updates specification.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (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 java.util.Map<java.lang.String,RemoteRefUpdate>expandMatching()Expands all placeholderRemoteRefUpdates for "matching"RefSpecs ":" intoPushand returns the resulting map in which the placeholders have been replaced by their expansion.private voidexpandMatching(java.util.Map<java.lang.String,RemoteRefUpdate> updates, RemoteRefUpdate match)Expands the placeholderRemoteRefUpdatematchfor a "matching"RefSpec":" or "+:" and puts the expansion into the given mapupdates.java.util.List<java.lang.String>getPushOptions()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 voidmodifyUpdatesForDryRun()private java.util.Map<java.lang.String,RemoteRefUpdate>prepareRemoteUpdates()private java.util.Map<java.lang.String,RemoteRefUpdate>rejectAll()private voidupdateTrackingRefs()
-
-
-
Field Detail
-
PROGRESS_OPENING_CONNECTION
static final java.lang.String PROGRESS_OPENING_CONNECTION
Task name forProgressMonitorused during opening connection.
-
transport
private final Transport transport
Transport used to perform this operation.
-
connection
private PushConnection connection
Push operation connection created to perform this operation
-
toPush
private final java.util.Map<java.lang.String,RemoteRefUpdate> toPush
Refs to update on remote side.
-
walker
private final RevWalk walker
Revision walker for checking some updates properties.
-
out
private final java.io.OutputStream out
an outputstream to write messages to
-
pushOptions
private java.util.List<java.lang.String> pushOptions
A list of option strings associated with this push
-
prePush
private final PrePushHook prePush
-
-
Constructor Detail
-
PushProcess
PushProcess(Transport transport, java.util.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, java.util.Collection<RemoteRefUpdate> toPush, PrePushHook prePush, java.io.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 Detail
-
execute
PushResult execute(ProgressMonitor monitor) throws NotSupportedException, TransportException
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
private java.util.Map<java.lang.String,RemoteRefUpdate> prepareRemoteUpdates() throws TransportException
- Throws:
TransportException
-
isFastForward
private boolean isFastForward(ObjectId oldOid, ObjectId newOid) throws TransportException
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
private java.util.Map<java.lang.String,RemoteRefUpdate> expandMatching() throws TransportException
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(java.util.Map<java.lang.String,RemoteRefUpdate> updates, RemoteRefUpdate match) throws TransportException
Expands 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
private java.util.Map<java.lang.String,RemoteRefUpdate> rejectAll()
-
modifyUpdatesForDryRun
private void modifyUpdatesForDryRun()
-
updateTrackingRefs
private void updateTrackingRefs()
-
getPushOptions
public java.util.List<java.lang.String> getPushOptions()
Gets the list of option strings associated with this push.- Returns:
- pushOptions
- Since:
- 4.5
-
-