changeset 3900:2b3175acb653

Don't use node length for calculating revision number length. Done by moving repo.lookup of revisions from commands.export to patch.export
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 15 Dec 2006 19:30:20 +0100
parents 504dee0abeac
children 733d56b8830f
files mercurial/commands.py mercurial/patch.py tests/test-export.out
diffstat 3 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Dec 15 19:09:10 2006 +0100
+++ b/mercurial/commands.py	Fri Dec 15 19:30:20 2006 +0100
@@ -1066,7 +1066,7 @@
         ui.note(_('exporting patches:\n'))
     else:
         ui.note(_('exporting patch:\n'))
-    patch.export(repo, map(repo.lookup, revs), template=opts['output'],
+    patch.export(repo, revs, template=opts['output'],
                  switch_parent=opts['switch_parent'],
                  opts=patch.diffopts(ui, opts))
 
--- a/mercurial/patch.py	Fri Dec 15 19:09:10 2006 +0100
+++ b/mercurial/patch.py	Fri Dec 15 19:30:20 2006 +0100
@@ -626,7 +626,7 @@
     '''export changesets as hg patches.'''
 
     total = len(revs)
-    revwidth = max(map(len, revs))
+    revwidth = max([len(str(rev)) for rev in revs])
 
     def single(node, seqno, fp):
         parents = [p for p in repo.changelog.parents(node) if p != nullid]
@@ -655,8 +655,8 @@
         if fp not in (sys.stdout, repo.ui):
             fp.close()
 
-    for seqno, cset in enumerate(revs):
-        single(cset, seqno+1, fp)
+    for seqno, rev in enumerate(revs):
+        single(repo.lookup(rev), seqno+1, fp)
 
 def diffstat(patchlines):
     fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt")
--- a/tests/test-export.out	Fri Dec 15 19:09:10 2006 +0100
+++ b/tests/test-export.out	Fri Dec 15 19:30:20 2006 +0100
@@ -48,13 +48,13 @@
 foo-f3acbafac161.patch
 # foo-%r.patch
 exporting patches:
-foo-00000000000000000002.patch
-foo-00000000000000000003.patch
-foo-00000000000000000004.patch
-foo-00000000000000000005.patch
-foo-00000000000000000006.patch
-foo-00000000000000000007.patch
-foo-00000000000000000008.patch
-foo-00000000000000000009.patch
-foo-00000000000000000010.patch
-foo-00000000000000000011.patch
+foo-02.patch
+foo-03.patch
+foo-04.patch
+foo-05.patch
+foo-06.patch
+foo-07.patch
+foo-08.patch
+foo-09.patch
+foo-10.patch
+foo-11.patch