relink/progress: Adding progress for pruning stage

timeless timeless at gmail.com
Thu Jun 10 06:29:16 CDT 2010


I ran out of disk space dealing with hg.mozilla.org/projects so now
I'm playing with the relink extension

# HG changeset patch
# User timeless <timeless at gmail.com>
# Date 1276168190 -7200
# Node ID cdc2f94f0fa97e8bae74dc456cd62a4f9ef21080
# Parent  8ebf3b07879efb8f95e005dbbeb462d83a1a90db
relink/progress: Adding progress for pruning stage

diff --git a/hgext/relink.py b/hgext/relink.py
--- a/hgext/relink.py
+++ b/hgext/relink.py
@@ -90,7 +90,10 @@ def prune(candidates, src, dst, ui):
         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 @@ def prune(candidates, src, dst, ui):
             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


More information about the Mercurial-devel mailing list