diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-07-27 11:59:31 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2011-07-28 10:22:50 -0700 |
commit | c81f6ab3abf9fecc298294b44385538ac9e80e92 (patch) | |
tree | 6658b320806d0c7610492681e5884c67efc032e7 | |
parent | e0111b18c8386d86eac2671b8cf639b63ec53560 (diff) | |
download | jgit-c81f6ab3abf9fecc298294b44385538ac9e80e92.tar.gz jgit-c81f6ab3abf9fecc298294b44385538ac9e80e92.zip |
IndexPack: Defer the "Resolving deltas" progress meter
If delta resolution completes in < 1000 milliseconds, don't bother
showing the progress meter. This is actually very common for a Gerrit
Code Review server, where the client is probably sending 1 commit and
only a few trees/blobs modified... and the base objects are hot in the
process buffer cache.
The 1000 millisecond delay is just a guess at a reasonable time to wait.
Change-Id: I440baa64ab0dfa21be61deae8dcd3ca061bed8ce
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 653fd4c403..1b30e859ec 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -54,6 +54,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.zip.DataFormatException; import java.util.zip.Inflater; @@ -61,6 +62,7 @@ import org.eclipse.jgit.JGitText; import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lib.AnyObjectId; +import org.eclipse.jgit.lib.BatchingProgressMonitor; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.InflaterCache; import org.eclipse.jgit.lib.MutableObjectId; @@ -478,6 +480,11 @@ public abstract class PackParser { if (!deferredCheckBlobs.isEmpty()) doDeferredCheckBlobs(); if (deltaCount > 0) { + if (resolving instanceof BatchingProgressMonitor) { + ((BatchingProgressMonitor) resolving).setDelayStart( + 1000, + TimeUnit.MILLISECONDS); + } resolving.beginTask(JGitText.get().resolvingDeltas, deltaCount); resolveDeltas(resolving); if (entryCount < objectCount) { |