changeset 16946:d9238286964e stable

merge with crew
author Matt Mackall <mpm@selenic.com>
date Tue, 12 Jun 2012 16:20:20 -0500
parents a2d6e336e9cc (current diff) 51932c835b74 (diff)
children dea63b30ddd6 0fdd8193c8b5
files
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Sat Jun 09 19:13:24 2012 -0600
+++ b/mercurial/archival.py	Tue Jun 12 16:20:20 2012 -0500
@@ -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,
--- a/tests/test-archive.t	Sat Jun 09 19:13:24 2012 -0600
+++ b/tests/test-archive.t	Tue Jun 12 16:20:20 2012 -0500
@@ -102,7 +102,10 @@
   test/baz/bletch
   test/foo
 
-  $ hg archive -t tbz2 -X baz test.tar.bz2
+  $ hg archive --debug -t tbz2 -X baz test.tar.bz2
+  archiving: 0/2 files (0.00%)
+  archiving: bar 1/2 files (50.00%)
+  archiving: foo 2/2 files (100.00%)
   $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
   test/.hg_archival.txt
   test/bar