Source

perfarce-patches / pull-progress.diff

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
# Date 1324483279 -3600
# Node ID 800fa1a12eda7878cabccbf772a60f4e52368999
# Parent  3592c6f741c43be5ef1f12ce17715046d74d0073
show progress output for pull

diff --git a/perfarce.py b/perfarce.py
--- a/perfarce.py
+++ b/perfarce.py
@@ -1115,11 +1115,16 @@ def pull(original, ui, repo, source=None
     tags = {}
 
     try:
-        for c in changes:
+        for i, c in enumerate(changes, start=1):
             ui.note(_('change %s\n') % c)
             cl = client.describe(c)
             files = client.fstat(c, all=bool(startrev))
 
+            if hasattr(ui, 'progress'):
+                ui.progress('pull', i,
+                            item=cl.change, unit='changelists',
+                            total=len(changes))
+
             if client.keep:
                 if startrev:
                     client.sync(c, all=True, force=True)
@@ -1128,6 +1133,11 @@ def pull(original, ui, repo, source=None
                                 abort=False)
                     client.sync(c, force=True, files=[f[0] for f in files])
 
+            if hasattr(ui, 'progress'):
+                ui.progress('pull', i,
+                            item=cl.change, unit='changelists',
+                            total=len(changes))
+
             nodes = client.parsenodes(cl.desc)
             if nodes:
                 parent = nodes[-1]
@@ -1173,6 +1183,9 @@ def pull(original, ui, repo, source=None
             ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
 
     finally:
+        if hasattr(ui, 'progress'):
+            ui.progress('pull', None)
+
         if tags:
             p4rev, p4id = client.find()
             ctx = repo[p4rev]