Top Description Fields Constructors Methods
org.eclipse.jgit.transport

pack-priv Class PushProcess

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.text.MessageFormat, java.util.Collection, .Collections, .LinkedHashMap, .List, .Map, java.util.stream.Collectors, org.eclipse.jgit.api.errors.AbortedByHookException, org.eclipse.jgit.errors.MissingObjectException, .NotSupportedException, .TransportException, org.eclipse.jgit.hooks.PrePushHook, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Constants, .ObjectId, .ProgressMonitor, .Ref, org.eclipse.jgit.revwalk.RevCommit, .RevObject, .RevWalk, org.eclipse.jgit.transport.RemoteRefUpdate.Status

Class performing push operation on remote repository.
See Also
Transport#push(ProgressMonitor, Collection, OutputStream)

Field Summary

Modifier and TypeField and Description
private PushConnection
connection

Push operation connection created to perform this operation

private final OutputStream
out

an outputstream to write messages to

private final PrePushHook
pack-priv static final String
PROGRESS_OPENING_CONNECTION

Task name for ProgressMonitor used during opening connection.

private List<String>
pushOptions

A list of option strings associated with this push

private final Map<String, RemoteRefUpdate>
toPush

Refs to update on remote side.

private final Transport
transport

Transport used to perform this operation.

private final RevWalk
walker

Revision walker for checking some updates properties.

Constructor Summary

AccessConstructor and Description
pack-priv
PushProcess(Transport
transport between remote and local repository, used to create connection.
transport
,
Collection<RemoteRefUpdate>
specification of refs updates (and local tracking branches).
toPush
,
PrePushHook
PrePushHook to run after the remote advertisement has been gotten
prePush
)

Create process for specified transport and refs updates specification.

pack-priv
PushProcess(Transport
transport between remote and local repository, used to create connection.
transport
,
Collection<RemoteRefUpdate>
specification of refs updates (and local tracking branches).
toPush
,
PrePushHook
PrePushHook to run after the remote advertisement has been gotten
prePush
,
OutputStream
OutputStream to write messages to
out
)

Create process for specified transport and refs updates specification.

Method Summary

Modifier and TypeMethod and Description
pack-priv PushResult

Returns:

result of push operation with complete status description.
execute
(ProgressMonitor
progress monitor used for feedback about operation.
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>

Returns:

a new map of RemoteRefUpdates keyed by remote name
expandMatching
()

Expands all placeholder RemoteRefUpdates for "matching" RefSpecs ":" in toPush and returns the resulting map in which the placeholders have been replaced by their expansion.

private void
expandMatching(Map<String, RemoteRefUpdate>
map to put the expansion in
updates
,
RemoteRefUpdate
the placeholder RemoteRefUpdate to expand
match
)

Expands the placeholder RemoteRefUpdate match for a "matching" RefSpec ":" or "+:" and puts the expansion into the given map updates.

public List<String>

Returns:

pushOptions
getPushOptions
()

Gets the list of option strings associated with this push.

private boolean

Returns:

true if the update fast-forwards, false otherwise
isFastForward
(ObjectId
ObjectId of the old commit
oldOid
,
ObjectId
ObjectId of the new commit
newOid
)

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.
private void
private Map<String, RemoteRefUpdate>
private Map<String, RemoteRefUpdate>
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionback to summary
private PushConnection connection

Push operation connection created to perform this operation

outback to summary
private final OutputStream out

an outputstream to write messages to

prePushback to summary
private final PrePushHook prePush
PROGRESS_OPENING_CONNECTIONback to summary
pack-priv static final String PROGRESS_OPENING_CONNECTION

Task name for ProgressMonitor used during opening connection.

pushOptionsback to summary
private List<String> pushOptions

A list of option strings associated with this push

toPushback to summary
private final Map<String, RemoteRefUpdate> toPush

Refs to update on remote side.

transportback to summary
private final Transport transport

Transport used to perform this operation.

walkerback to summary
private final RevWalk walker

Revision walker for checking some updates properties.

Constructor Detail

PushProcessback to summary
pack-priv PushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush) throws TransportException

Create process for specified transport and refs updates specification.

Parameters
transport:Transport

transport between remote and local repository, used to create connection.

toPush:Collection<RemoteRefUpdate>

specification of refs updates (and local tracking branches).

prePush:PrePushHook

PrePushHook to run after the remote advertisement has been gotten

Exceptions
TransportException:
if a protocol error occurred during push/fetch
PushProcessback to summary
pack-priv PushProcess(Transport transport, Collection<RemoteRefUpdate> toPush, PrePushHook prePush, OutputStream out) throws TransportException

Create process for specified transport and refs updates specification.

Parameters
transport:Transport

transport between remote and local repository, used to create connection.

toPush:Collection<RemoteRefUpdate>

specification of refs updates (and local tracking branches).

prePush:PrePushHook

PrePushHook to run after the remote advertisement has been gotten

out:OutputStream

OutputStream to write messages to

Exceptions
TransportException:
if a protocol error occurred during push/fetch

Method Detail

executeback to summary
pack-priv 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:ProgressMonitor

progress monitor used for feedback about operation.

Returns:PushResult

result of push operation with complete status description.

Exceptions
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.
expandMatchingback to summary
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:Map<String, RemoteRefUpdate>

a new map of RemoteRefUpdates keyed by remote name

Exceptions
TransportException:
if the expansion results in duplicate updates
expandMatchingback to summary
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<String, RemoteRefUpdate>

map to put the expansion in

match:RemoteRefUpdate

the placeholder RemoteRefUpdate to expand

Exceptions
TransportException:
if the expansion results in duplicate updates, or the local branches cannot be determined
getPushOptionsback to summary
public List<String> getPushOptions()

Gets the list of option strings associated with this push.

Returns:List<String>

pushOptions

Since
4.5
isFastForwardback to summary
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

ObjectId of the old commit

newOid:ObjectId

ObjectId of the new commit

Returns:boolean

true if the update fast-forwards, false otherwise

Exceptions
TransportException:
if a protocol error occurred during push/fetch
modifyUpdatesForDryRunback to summary
private void modifyUpdatesForDryRun()
prepareRemoteUpdatesback to summary
private Map<String, RemoteRefUpdate> prepareRemoteUpdates() throws TransportException
rejectAllback to summary
private Map<String, RemoteRefUpdate> rejectAll()
updateTrackingRefsback to summary
private void updateTrackingRefs()