This is the canonical implementation for transferring objects to the remote repository from the local repository by talking to the 'git-receive-pack' service. Objects are packed on the local side into a pack file and then sent to the remote repository.
This connection requires only a bi-directional pipe or socket, and thus is easily wrapped up into a local process pipe, anonymous TCP socket, or a command executed through an SSH tunnel.
This implementation honors
org. option.
Concrete implementations should just call
init(java. and
readAdvertisedRefs() methods in constructor or before any use. They
should also handle resources releasing in close() method if needed.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| public static final String | CAPABILITY_DELETE_REFS
The server supports deleting refs. |
| public static final String | CAPABILITY_OFS_DELTA
The server supports packs with OFS deltas. |
| public static final String | CAPABILITY_PUSH_OPTIONS
The server supports the receiving of push options. |
| public static final String | CAPABILITY_REPORT_STATUS
The client expects a status report after the server processes the pack. |
| public static final String | CAPABILITY_SIDE_BAND_64K
The client supports using the 64K side-band for progress messages. |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private long | packTransferTime
Time in milliseconds spent transferring the pack data. |
| private List | pushOptions
A list of option strings associated with this push. |
| private boolean | |
| private final boolean | |
| private final boolean | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | BasePackPushConnection(PackTransport
the transport. packTransport)Create a new connection to push using the native git transport. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | doPush(final ProgressMonitor
progress monitor to receive status updates. monitor, final Map<String, RemoteRefUpdate> update commands to be applied to the remote repository. refUpdates, OutputStream output stream to write sideband messages to outputStream)Push one or more objects and update the remote repository. |
| private String | |
| public List | |
| public boolean | |
| protected TransportException | noRepository(Throwable
root cause exception cause)Overrides org. Create an exception to indicate problems finding a remote repository. |
| public void | push(final ProgressMonitor
progress monitor to update the end-user about the amount of
work completed, or to indicate cancellation. Implementors
should poll the monitor at regular intervals to look for
cancellation requests from the user. monitor, final Map<String, RemoteRefUpdate> map of remote refnames to remote refs update
specifications/statuses. Can't be empty. This indicate what
refs caller want to update on remote side. Only refs updates
with
refUpdates)org.
should passed. Implementation must ensure that and appropriate
status with optional message should be set during call. No
refUpdate with
org.
or
org.
can be leaved by implementation after return from this call.Implements org. Pushes to the remote repository basing on provided specification. |
| public void | push(final ProgressMonitor
progress monitor to update the end-user about the amount of
work completed, or to indicate cancellation. Implementors
should poll the monitor at regular intervals to look for
cancellation requests from the user. monitor, final Map<String, RemoteRefUpdate> map of remote refnames to remote refs update
specifications/statuses. Can't be empty. This indicate what
refs caller want to update on remote side. Only refs updates
with
refUpdates, OutputStream org.
should passed. Implementation must ensure that and appropriate
status with optional message should be set during call. No
refUpdate with
org.
or
org.
can be leaved by implementation after return from this call.output stream to write sideband messages to outputStream)Implements org. Pushes to the remote repository basing on provided specification. |
| private void | |
| private String | |
| private void | |
| private void | writeCommands(final Collection<RemoteRefUpdate> refUpdates, final ProgressMonitor monitor, OutputStream outputStream)
|
| private void |
| atomic | back to summary |
|---|---|
| private final boolean atomic | |
| CAPABILITY_DELETE_REFS | back to summary |
|---|---|
| public static final String CAPABILITY_DELETE_REFS The server supports deleting refs.
| |
| CAPABILITY_OFS_DELTA | back to summary |
|---|---|
| public static final String CAPABILITY_OFS_DELTA The server supports packs with OFS deltas.
| |
| CAPABILITY_PUSH_OPTIONS | back to summary |
|---|---|
| public static final String CAPABILITY_PUSH_OPTIONS The server supports the receiving of push options.
| |
| CAPABILITY_REPORT_STATUS | back to summary |
|---|---|
| public static final String CAPABILITY_REPORT_STATUS The client expects a status report after the server processes the pack.
| |
| CAPABILITY_SIDE_BAND_64K | back to summary |
|---|---|
| public static final String CAPABILITY_SIDE_BAND_64K The client supports using the 64K side-band for progress messages.
| |
| capableAtomic | back to summary |
|---|---|
| private boolean capableAtomic | |
| capableDeleteRefs | back to summary |
|---|---|
| private boolean capableDeleteRefs | |
| capableOfsDelta | back to summary |
|---|---|
| private boolean capableOfsDelta | |
| capablePushOptions | back to summary |
|---|---|
| private boolean capablePushOptions | |
| capableReport | back to summary |
|---|---|
| private boolean capableReport | |
| capableSideBand | back to summary |
|---|---|
| private boolean capableSideBand | |
| packTransferTime | back to summary |
|---|---|
| private long packTransferTime Time in milliseconds spent transferring the pack data. | |
| pushOptions | back to summary |
|---|---|
| private List<String> pushOptions A list of option strings associated with this push. | |
| sentCommand | back to summary |
|---|---|
| private boolean sentCommand | |
| thinPack | back to summary |
|---|---|
| private final boolean thinPack | |
| useBitmaps | back to summary |
|---|---|
| private final boolean useBitmaps | |
| writePack | back to summary |
|---|---|
| private boolean writePack | |
| BasePackPushConnection | back to summary |
|---|---|
| public BasePackPushConnection(PackTransport packTransport) Create a new connection to push using the native git transport.
| |
| doPush | back to summary |
|---|---|
| protected void doPush(final ProgressMonitor monitor, final Map<String, RemoteRefUpdate> refUpdates, OutputStream outputStream) throws TransportException Push one or more objects and update the remote repository.
| |
| enableCapabilities | back to summary |
|---|---|
| private String enableCapabilities(final ProgressMonitor monitor, OutputStream outputStream) | |
| getPushOptions | back to summary |
|---|---|
| public List Gets the list of option strings associated with this push. | |
| isUseBitmaps | back to summary |
|---|---|
| public boolean isUseBitmaps() Whether to use bitmaps for push.
| |
| noRepository | back to summary |
|---|---|
| protected TransportException noRepository(Throwable cause) Overrides org. Doc from org. Create an exception to indicate problems finding a remote repository. The caller is expected to throw the returned exception. Subclasses may override this method to provide better diagnostics.
| |
| push | back to summary |
|---|---|
| public void push(final ProgressMonitor monitor, final Map<String, RemoteRefUpdate> refUpdates) throws TransportException Implements org. Doc from org. Pushes to the remote repository basing on provided specification. This possibly result in update/creation/deletion of refs on remote repository and sending objects that remote repository need to have a consistent objects graph from new refs.
Only one call per connection is allowed. Subsequent calls will result in
Implementation may use local repository to send a minimum set of objects
needed by remote repository in efficient way.
| |
| push | back to summary |
|---|---|
| public void push(final ProgressMonitor monitor, final Map<String, RemoteRefUpdate> refUpdates, OutputStream outputStream) throws TransportException Implements org. Doc from org. Pushes to the remote repository basing on provided specification. This possibly result in update/creation/deletion of refs on remote repository and sending objects that remote repository need to have a consistent objects graph from new refs.
Only one call per connection is allowed. Subsequent calls will result in
Implementation may use local repository to send a minimum set of objects
needed by remote repository in efficient way.
| |
| readStatusReport | back to summary |
|---|---|
| private void readStatusReport(Map<String, RemoteRefUpdate> refUpdates) throws IOException | |
| readStringLongTimeout | back to summary |
|---|---|
| private String readStringLongTimeout() throws IOException | |
| transmitOptions | back to summary |
|---|---|
| private void transmitOptions() throws IOException | |
| writeCommands | back to summary |
|---|---|
| private void writeCommands(final Collection<RemoteRefUpdate> refUpdates, final ProgressMonitor monitor, OutputStream outputStream) throws IOException | |
| writePack | back to summary |
|---|---|
| private void writePack(final Map<String, RemoteRefUpdate> refUpdates, final ProgressMonitor monitor) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| private final InputStream | |
| private final OutputStream |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private IOException | |
| public void | flush()
Overrides java. Implements java. Flushes this output stream and forces any buffered output bytes to be written out. |
| public void | write(int
the b)byte.Implements abstract java. Writes the specified byte to this output stream. |
| public void | write(byte[]
the data. buf, int the start offset in the data. ptr, int the number of bytes to write. cnt)Overrides java. Writes |
| in | back to summary |
|---|---|
| private final InputStream in | |
| out | back to summary |
|---|---|
| private final OutputStream out | |
| CheckingSideBandOutputStream | back to summary |
|---|---|
| pack-priv CheckingSideBandOutputStream(InputStream in, OutputStream out) | |
| checkError | back to summary |
|---|---|
| private IOException checkError(IOException e1) | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes
to be written out. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf, int ptr, int cnt) throws IOException Overrides java. Doc from java. Writes
If
If
| |