diff options
author | Shawn Pearce <spearce@spearce.org> | 2014-03-12 17:13:10 -0700 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2014-03-12 23:19:12 -0400 |
commit | 4c3e7931ed1eb2c686e6e90a57e9122cf603d68c (patch) | |
tree | 903185444bb7d7ebb7c39e753215a136ada82087 | |
parent | 088e80315b1289a108254354328ff06cff8b8080 (diff) | |
download | jgit-4c3e7931ed1eb2c686e6e90a57e9122cf603d68c.tar.gz jgit-4c3e7931ed1eb2c686e6e90a57e9122cf603d68c.zip |
Display progress while checking connectivity on push
Verifying 100 new objects are fully connected to the existing DAG
is usually very cheap. Checking the entire Linux kernel history is
fully connected when pushing it to a new repository can take 30-60
seconds. Display a progress counter during this time so the client
knows the server is still working.
Change-Id: Iababe3ee1d35cb82f2bef2f12da7a2ecd03282b0
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index ff45b1cda3..9d39f436c6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -1036,6 +1036,12 @@ public abstract class BaseReceivePack { private void checkConnectivity() throws IOException { ObjectIdSubclassMap<ObjectId> baseObjects = null; ObjectIdSubclassMap<ObjectId> providedObjects = null; + ProgressMonitor checking = NullProgressMonitor.INSTANCE; + if (sideBand) { + SideBandProgressMonitor m = new SideBandProgressMonitor(msgOut); + m.setDelayStart(750, TimeUnit.MILLISECONDS); + checking = m; + } if (checkReferencedIsReachable) { baseObjects = parser.getBaseObjectIds(); @@ -1071,8 +1077,10 @@ public abstract class BaseReceivePack { } } + checking.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN); RevCommit c; while ((c = ow.next()) != null) { + checking.update(1); if (providedObjects != null // && !c.has(RevFlag.UNINTERESTING) // && !providedObjects.contains(c)) @@ -1081,6 +1089,7 @@ public abstract class BaseReceivePack { RevObject o; while ((o = ow.nextObject()) != null) { + checking.update(1); if (o.has(RevFlag.UNINTERESTING)) continue; @@ -1094,6 +1103,7 @@ public abstract class BaseReceivePack { if (o instanceof RevBlob && !db.hasObject(o)) throw new MissingObjectException(o, Constants.TYPE_BLOB); } + checking.endTask(); if (baseObjects != null) { for (ObjectId id : baseObjects) { |