Class PushProcess

java.lang.Object
org.eclipse.jgit.transport.PushProcess

class PushProcess extends Object
Class performing push operation on remote repository.
See Also:
  • Field Details

    • PROGRESS_OPENING_CONNECTION

      static final String PROGRESS_OPENING_CONNECTION
      Task name for ProgressMonitor used 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 Map<String,RemoteRefUpdate> toPush
      Refs to update on remote side.
    • walker

      private final RevWalk walker
      Revision walker for checking some updates properties.
    • out

      private final OutputStream out
      an outputstream to write messages to
    • pushOptions

      private List<String> pushOptions
      A list of option strings associated with this push
    • prePush

      private final PrePushHook 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 - PrePushHook to 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 - PrePushHook to run after the remote advertisement has been gotten
      out - 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

      private Map<String,RemoteRefUpdate> prepareRemoteUpdates() throws TransportException
      Throws:
      TransportException
    • isFastForward

      private boolean isFastForward(ObjectId oldOid, ObjectId newOid) throws TransportException
      Determines whether an update from oldOid to newOid is 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 - ObjectId of the old commit
      newOid - ObjectId of the new commit
      Returns:
      true if the update fast-forwards, false otherwise
      Throws:
      TransportException
    • expandMatching

      private Map<String,RemoteRefUpdate> expandMatching() throws TransportException
      Expands all placeholder RemoteRefUpdates for "matching" RefSpecs ":" in toPush and 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 TransportException
      Expands the placeholder RemoteRefUpdate match for a "matching" RefSpec ":" or "+:" and puts the expansion into the given map updates.
      Parameters:
      updates - map to put the expansion in
      match - the placeholder RemoteRefUpdate to expand
      Throws:
      TransportException - if the expansion results in duplicate updates, or the local branches cannot be determined
    • rejectAll

      private Map<String,RemoteRefUpdate> rejectAll()
    • modifyUpdatesForDryRun

      private void modifyUpdatesForDryRun()
    • updateTrackingRefs

      private void updateTrackingRefs()
    • getPushOptions

      public List<String> getPushOptions()
      Gets the list of option strings associated with this push.
      Returns:
      pushOptions
      Since:
      4.5