From a6c03819965fb0232c3022bb130ca04c7e3bde48 Mon Sep 17 00:00:00 2001 From: Thomas Arendsen Hein Date: Fri, 15 Dec 2006 19:30:20 +0100 Subject: [PATCH] Don't use node length for calculating revision number length. Done by moving repo.lookup of revisions from commands.export to patch.export --- mercurial/commands.py | 2 +- mercurial/patch.py | 6 +++--- tests/test-export.out | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mercurial/commands.py b/mercurial/commands.py index 193b5a43e8..5c65f250a5 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1066,7 +1066,7 @@ def export(ui, repo, *changesets, **opts): 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)) diff --git a/mercurial/patch.py b/mercurial/patch.py index 0e3fe9d6d0..5da4b64157 100644 --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -626,7 +626,7 @@ def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, '''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 @@ def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, 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") diff --git a/tests/test-export.out b/tests/test-export.out index 795c2144be..d9ed32a68b 100644 --- a/tests/test-export.out +++ b/tests/test-export.out @@ -48,13 +48,13 @@ foo-5f17a83f5fbd.patch 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