# HG changeset patch # User Thomas Arendsen Hein # Date 1166207420 -3600 # Node ID 2b3175acb65336531add235712c8bede9474e00f # Parent 504dee0abeacab1cdffc90924c4302bc870fdcc1 Don't use node length for calculating revision number length. Done by moving repo.lookup of revisions from commands.export to patch.export diff --git a/mercurial/commands.py b/mercurial/commands.py --- 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 --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -626,7 +626,7 @@ def export(repo, revs, template='hg-%h.p '''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.p 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 --- 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