aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-07-27 12:10:19 -0700
committerShawn O. Pearce <spearce@spearce.org>2011-07-28 10:22:50 -0700
commit68cc21b60d83b5c4fb1de6c34a79836c51dd9b3b (patch)
tree5648d31600fb37c02680fc3482de7178e16dbaa8
parentc81f6ab3abf9fecc298294b44385538ac9e80e92 (diff)
downloadjgit-68cc21b60d83b5c4fb1de6c34a79836c51dd9b3b.tar.gz
jgit-68cc21b60d83b5c4fb1de6c34a79836c51dd9b3b.zip
PackWriter: Skip progress messages on fast operations
If the "Finding sources" phase will complete in <1 second with no delta compression enabled, don't bother showing the progress meter for this phase. Small repositories on the local filesystem tend to rip through this phase always subsecond and the ProgressMonitor display can actually slow the operation down. If delta compression is enabled, there are two phases that may run very quickly. Set the timer to 500 milliseconds instead, reducing the risk that the user has to wait longer than 1 second before any sort of output from the packer occurs. Change-Id: I58110f17e2a5ffa0134f9768b94804d16bbb8399 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
index 8a912aeb6b..3007b809c2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
@@ -80,6 +80,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.AsyncObjectSizeQueue;
+import org.eclipse.jgit.lib.BatchingProgressMonitor;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
@@ -640,10 +641,21 @@ public class PackWriter {
if (writeMonitor == null)
writeMonitor = NullProgressMonitor.INSTANCE;
- if (reuseSupport != null && (
+ boolean needSearchForReuse = reuseSupport != null && (
reuseDeltas
|| config.isReuseObjects()
- || !cachedPacks.isEmpty()))
+ || !cachedPacks.isEmpty());
+
+ if (compressMonitor instanceof BatchingProgressMonitor) {
+ long delay = 1000;
+ if (needSearchForReuse && config.isDeltaCompress())
+ delay = 500;
+ ((BatchingProgressMonitor) compressMonitor).setDelayStart(
+ delay,
+ TimeUnit.MILLISECONDS);
+ }
+
+ if (needSearchForReuse)
searchForReuse(compressMonitor);
if (config.isDeltaCompress())
searchForDeltas(compressMonitor);