Source

perfarce-patches / sync-progress.diff

Full commit
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
# Date 1324407363 -3600
# Node ID 3592c6f741c43be5ef1f12ce17715046d74d0073
# Parent  58e6440e8b1c08e46210b96ce7856d52a7548dd0
suppress progress for sync for small changelists

...and then display it for every change if need be

diff --git a/perfarce.py b/perfarce.py
--- a/perfarce.py
+++ b/perfarce.py
@@ -716,9 +716,8 @@ class p4client(object):
         n = 0
         for d in self.run(cmd, files=[("%s@%d" % (os.path.join(self.partial, f), change)) for f in files], abort=False):
             n += 1
-            if n % 250 == 0:
-                if hasattr(self.ui, 'progress'):
-                    self.ui.progress('p4 sync', n, unit='files')
+            if len(files) > 250 and hasattr(self.ui, 'progress'):
+                self.ui.progress('p4 sync', n, unit='files', total=len(files))
             code = d.get('code')
             if code == 'error':
                 data = d['data'].strip()
@@ -727,7 +726,7 @@ class p4client(object):
                 else:
                     raise util.Abort('p4: %s' % data)
 
-        if hasattr(self.ui, 'progress'):
+        if len(files) > 250 and hasattr(self.ui, 'progress'):
             self.ui.progress('p4 sync', None)
 
         if files and n < len(files):