diff mercurial/archival.py @ 16919:51932c835b74 stable

archive: make progress only show files that are actually archived Before this, files that are excluded (or not included) were shown when using progress bar or --debug. Reported by Andrew Shadura.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 12 Jun 2012 12:05:52 +0200
parents 774da7121fc9
children 1894dac619de
line wrap: on
line diff
--- a/mercurial/archival.py	Wed Jun 06 21:17:20 2012 -0500
+++ b/mercurial/archival.py	Tue Jun 12 12:05:52 2012 +0200
@@ -234,8 +234,6 @@
         prefix = tidyprefix(dest, kind, prefix)
 
     def write(name, mode, islink, getdata):
-        if matchfn and not matchfn(name):
-            return
         data = getdata()
         if decode:
             data = repo.wwritedata(name, data)
@@ -265,11 +263,18 @@
 
             return base + tags
 
-        write('.hg_archival.txt', 0644, False, metadata)
+        name = '.hg_archival.txt'
+        if not matchfn or matchfn(name):
+            write(name, 0644, False, metadata)
 
-    total = len(ctx.manifest())
+    if matchfn:
+        files = [f for f in ctx.manifest().keys() if matchfn(f)]
+    else:
+        files = ctx.manifest().keys()
+    files.sort()
+    total = len(files)
     repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total)
-    for i, f in enumerate(ctx):
+    for i, f in enumerate(files):
         ff = ctx.flags(f)
         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)
         repo.ui.progress(_('archiving'), i + 1, item=f,