relink/progress: Adding progress for pruning stage
authortimeless <timeless@gmail.com>
Thu, 10 Jun 2010 13:09:50 +0200
changeset 11354 412a6e749f8d
parent 11353 f2b25e8ea6c1
child 11355 9011036ba79d
relink/progress: Adding progress for pruning stage
hgext/relink.py
tests/test-relink.out
--- a/hgext/relink.py	Mon Jun 14 16:06:52 2010 -0400
+++ b/hgext/relink.py	Thu Jun 10 13:09:50 2010 +0200
@@ -90,7 +90,10 @@
         return st
 
     targets = []
+    total = len(candidates)
+    pos = 0
     for fn, st in candidates:
+        pos += 1
         srcpath = os.path.join(src, fn)
         tgt = os.path.join(dst, fn)
         ts = linkfilter(srcpath, tgt, st)
@@ -98,7 +101,9 @@
             ui.debug(_('not linkable: %s\n') % fn)
             continue
         targets.append((fn, ts.st_size))
+        ui.progress(_('pruning'), pos, fn, _(' files'), total)
 
+    ui.progress(_('pruning'), None)
     ui.status(_('pruned down to %d probably relinkable files\n') % len(targets))
     return targets
 
--- a/tests/test-relink.out	Mon Jun 14 16:06:52 2010 -0400
+++ b/tests/test-relink.out	Thu Jun 10 13:09:50 2010 +0200
@@ -15,7 +15,9 @@
 collected 5 candidate storage files
 not linkable: 00changelog.i
 not linkable: 00manifest.i
+pruning: data/a.i 3/5  files (60.00%)
 not linkable: data/b.i
+pruning: data/dummy.i 5/5  files (100.00%)
 pruned down to 2 probably relinkable files
 relinking: data/a.i 1/2  files (50.00%)
 not linkable: data/dummy.i