archive: make the %r escape work.
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Wed, 11 Jul 2007 19:56:16 -0300
changeset 4836 0e2d0a78f81a
parent 4835 9858477ed74c
child 4868 192cd95c2ba8
child 4877 242026115e6a
archive: make the %r escape work.
mercurial/cmdutil.py
tests/test-archive
tests/test-archive.out
--- a/mercurial/cmdutil.py	Wed Jul 11 19:56:16 2007 -0300
+++ b/mercurial/cmdutil.py	Wed Jul 11 19:56:16 2007 -0300
@@ -542,9 +542,9 @@
     try:
         if node:
             expander.update(node_expander)
-        if node and revwidth is not None:
+        if node:
             expander['r'] = (lambda:
-                    str(repo.changelog.rev(node)).zfill(revwidth))
+                    str(repo.changelog.rev(node)).zfill(revwidth or 0))
         if total is not None:
             expander['N'] = lambda: str(total)
         if seqno is not None:
--- a/tests/test-archive	Wed Jul 11 19:56:16 2007 -0300
+++ b/tests/test-archive	Wed Jul 11 19:56:16 2007 -0300
@@ -63,3 +63,7 @@
 unzip -t test.zip
 
 hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"
+hg archive -r 0 -t tar rev-%r.tar
+if [ -f rev-0.tar ]; then
+    echo 'rev-0.tar created'
+fi
--- a/tests/test-archive.out	Wed Jul 11 19:56:16 2007 -0300
+++ b/tests/test-archive.out	Wed Jul 11 19:56:16 2007 -0300
@@ -38,3 +38,4 @@
 test-TIP/bar
 test-TIP/baz/bletch
 test-TIP/foo
+rev-0.tar created