]> source.dussan.org Git - jgit.git/commitdiff
Correctly classify the compressing objects phase 08/1108/1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 9 Jul 2010 15:04:06 +0000 (08:04 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 10 Jul 2010 02:06:10 +0000 (19:06 -0700)
Searching for reuse candidates should be fast compared to actually
doing delta compression.  So pull the progress monitor out of this
phase and rename it back to identify the compressing objects state.

Change-Id: I5eb80919f21c1251e0e3420ff7774126f1f79b27
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

index 7cf8d2a26ebcfb14fc81cb15e2a05acefabbc943..cae552831c99dd9dac9eab62a8ff31145b8ef71b 100644 (file)
@@ -122,12 +122,11 @@ public class PackWriter {
        public static final String COUNTING_OBJECTS_PROGRESS = JGitText.get().countingObjects;
 
        /**
-        * Title of {@link ProgressMonitor} task used during searching for objects
-        * reuse or delta reuse.
+        * Title of {@link ProgressMonitor} task used during compression.
         *
         * @see #writePack(ProgressMonitor, ProgressMonitor, OutputStream)
         */
-       public static final String SEARCHING_REUSE_PROGRESS = JGitText.get().compressingObjects;
+       public static final String COMPRESSING_OBJECTS_PROGRESS = JGitText.get().compressingObjects;
 
        /**
         * Title of {@link ProgressMonitor} task used during writing out pack
@@ -686,7 +685,7 @@ public class PackWriter {
         * <p>
         * At first, this method collects and sorts objects to pack, then deltas
         * search is performed if set up accordingly, finally pack stream is
-        * written. {@link ProgressMonitor} tasks {@value #SEARCHING_REUSE_PROGRESS}
+        * written. {@link ProgressMonitor} tasks {@value #COMPRESSING_OBJECTS_PROGRESS}
         * (only if reuseDeltas or reuseObjects is enabled) and
         * {@value #WRITING_OBJECTS_PROGRESS} are updated during packing.
         * </p>
@@ -716,7 +715,7 @@ public class PackWriter {
                        writeMonitor = NullProgressMonitor.INSTANCE;
 
                if ((reuseDeltas || reuseObjects) && reuseSupport != null)
-                       searchForReuse(compressMonitor);
+                       searchForReuse();
 
                final PackOutputStream out = new PackOutputStream(writeMonitor,
                                packStream, isDeltaBaseAsOffset());
@@ -739,19 +738,11 @@ public class PackWriter {
                }
        }
 
-       private void searchForReuse(ProgressMonitor compressMonitor)
-                       throws IOException {
-               compressMonitor.beginTask(SEARCHING_REUSE_PROGRESS, getObjectsNumber());
+       private void searchForReuse() throws IOException {
                for (List<ObjectToPack> list : objectsLists) {
-                       for (ObjectToPack otp : list) {
-                               if (compressMonitor.isCancelled())
-                                       throw new IOException(
-                                                       JGitText.get().packingCancelledDuringObjectsWriting);
+                       for (ObjectToPack otp : list)
                                reuseSupport.selectObjectRepresentation(this, otp);
-                               compressMonitor.update(1);
-                       }
                }
-               compressMonitor.endTask();
        }
 
        private void writeObjects(ProgressMonitor writeMonitor, PackOutputStream out)