]> source.dussan.org Git - jgit.git/commitdiff
Expose pack fetch/push connections for subclassing 46/1246/3
authorShawn O. Pearce <spearce@spearce.org>
Wed, 4 Aug 2010 00:40:01 +0000 (17:40 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 21 Aug 2010 00:59:36 +0000 (17:59 -0700)
These classes need to be visible if an application wants to define
its own native pack based protocol embedded within another layer,
much like we already support for smart HTTP.

Change-Id: I7e2ac3ad01d15b94d340128a395fe0b2f560ff35
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java

index af18f18d8e0465cffdf4ee970494bed28385c32d..19f5748a229ca81c92bfb4bb493c118c60a1e14c 100644 (file)
@@ -98,8 +98,8 @@ import org.eclipse.jgit.util.TemporaryBuffer;
  * {@link #readAdvertisedRefs()} methods in constructor or before any use. They
  * should also handle resources releasing in {@link #close()} method if needed.
  */
-abstract class BasePackFetchConnection extends BasePackConnection implements
-               FetchConnection {
+public abstract class BasePackFetchConnection extends BasePackConnection
+               implements FetchConnection {
        /**
         * Maximum number of 'have' lines to send before giving up.
         * <p>
@@ -177,7 +177,13 @@ abstract class BasePackFetchConnection extends BasePackConnection implements
 
        private PacketLineOut pckState;
 
-       BasePackFetchConnection(final PackTransport packTransport) {
+       /**
+        * Create a new connection to fetch using the native git transport.
+        *
+        * @param packTransport
+        *            the transport.
+        */
+       public BasePackFetchConnection(final PackTransport packTransport) {
                super(packTransport);
 
                final FetchConfig cfg = local.getConfig().get(FetchConfig.KEY);
@@ -236,6 +242,20 @@ abstract class BasePackFetchConnection extends BasePackConnection implements
                return Collections.<PackLock> emptyList();
        }
 
+       /**
+        * Execute common ancestor negotiation and fetch the objects.
+        *
+        * @param monitor
+        *            progress monitor to receive status updates.
+        * @param want
+        *            the advertised remote references the caller wants to fetch.
+        * @param have
+        *            additional objects to assume that already exist locally. This
+        *            will be added to the set of objects reachable from the
+        *            destination repository's references.
+        * @throws TransportException
+        *             if any exception occurs.
+        */
        protected void doFetch(final ProgressMonitor monitor,
                        final Collection<Ref> want, final Set<ObjectId> have)
                        throws TransportException {
index 0838f29c1ad65ee5c625124c60e3292d6694b70d..2112d85b321b181a2c6665a3b26a30126bca9af8 100644 (file)
@@ -81,7 +81,7 @@ import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
  * {@link #readAdvertisedRefs()} methods in constructor or before any use. They
  * should also handle resources releasing in {@link #close()} method if needed.
  */
-class BasePackPushConnection extends BasePackConnection implements
+public abstract class BasePackPushConnection extends BasePackConnection implements
                PushConnection {
        static final String CAPABILITY_REPORT_STATUS = "report-status";
 
@@ -108,7 +108,13 @@ class BasePackPushConnection extends BasePackConnection implements
        /** Time in milliseconds spent transferring the pack data. */
        private long packTransferTime;
 
-       BasePackPushConnection(final PackTransport packTransport) {
+       /**
+        * Create a new connection to push using the native git transport.
+        *
+        * @param packTransport
+        *            the transport.
+        */
+       public BasePackPushConnection(final PackTransport packTransport) {
                super(packTransport);
                thinPack = transport.isPushThin();
        }
@@ -143,6 +149,16 @@ class BasePackPushConnection extends BasePackConnection implements
                return new TransportException(uri, JGitText.get().pushNotPermitted);
        }
 
+       /**
+        * Push one or more objects and update the remote repository.
+        *
+        * @param monitor
+        *            progress monitor to receive status updates.
+        * @param refUpdates
+        *            update commands to be applied to the remote repository.
+        * @throws TransportException
+        *             if any exception occurs.
+        */
        protected void doPush(final ProgressMonitor monitor,
                        final Map<String, RemoteRefUpdate> refUpdates)
                        throws TransportException {