diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-08-05 21:21:10 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-08-05 21:21:10 -0400 |
commit | 86ecf141b6e94f18702224e60e8992cafe4d02bc (patch) | |
tree | 2b7e8164c5b31f57124c79747d4ad7bfd18f08b5 | |
parent | 1067f82f562231cca1a7d75c6f0c2d2ce04c7381 (diff) | |
parent | 68cc21b60d83b5c4fb1de6c34a79836c51dd9b3b (diff) | |
download | jgit-86ecf141b6e94f18702224e60e8992cafe4d02bc.tar.gz jgit-86ecf141b6e94f18702224e60e8992cafe4d02bc.zip |
Merge changes I58110f17,I440baa64,Ic77dcac5
* changes:
PackWriter: Skip progress messages on fast operations
IndexPack: Defer the "Resolving deltas" progress meter
IndexPack: Fix "Resolving deltas" progress meter
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java | 16 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java | 27 |
2 files changed, 32 insertions, 11 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); 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 03370034b2..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,12 @@ 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) { if (!isAllowThin()) { @@ -494,6 +502,7 @@ public abstract class PackParser { (objectCount - entryCount))); } } + resolving.endTask(); } packDigest = null; @@ -518,20 +527,17 @@ public abstract class PackParser { private void resolveDeltas(final ProgressMonitor progress) throws IOException { - progress.beginTask(JGitText.get().resolvingDeltas, deltaCount); final int last = entryCount; for (int i = 0; i < last; i++) { - final int before = entryCount; - resolveDeltas(entries[i]); - progress.update(entryCount - before); + resolveDeltas(entries[i], progress); if (progress.isCancelled()) throw new IOException( JGitText.get().downloadCancelledDuringIndexing); } - progress.endTask(); } - private void resolveDeltas(final PackedObjectInfo oe) throws IOException { + private void resolveDeltas(final PackedObjectInfo oe, + ProgressMonitor progress) throws IOException { UnresolvedDelta children = firstChildOf(oe); if (children == null) return; @@ -559,12 +565,14 @@ public abstract class PackParser { .getOffset())); } - resolveDeltas(visit.next(), info.type, info); + resolveDeltas(visit.next(), info.type, info, progress); } private void resolveDeltas(DeltaVisit visit, final int type, - ObjectTypeAndSize info) throws IOException { + ObjectTypeAndSize info, ProgressMonitor progress) + throws IOException { do { + progress.update(1); info = openDatabase(visit.delta, info); switch (info.type) { case Constants.OBJ_OFS_DELTA: @@ -749,7 +757,8 @@ public abstract class PackParser { entries[entryCount++] = oe; visit.nextChild = firstChildOf(oe); - resolveDeltas(visit.next(), typeCode, new ObjectTypeAndSize()); + resolveDeltas(visit.next(), typeCode, + new ObjectTypeAndSize(), progress); if (progress.isCancelled()) throw new IOException( |