# HG changeset patch # User Patrick Mezard # Date 1182291771 -7200 # Node ID 178778ca648f30ef86d80cec6328506a77a82ab9 # Parent 63b9d2deed48a80549bce637517ef9d4ac3f4873# Parent c7371aa0c153af7e469e03762eb119b9f936996e Merge with crew-stable diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2743,7 +2743,9 @@ table = { "debugdata": (debugdata, [], _('debugdata FILE REV')), "debugindex": (debugindex, [], _('debugindex FILE')), "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), - "debugrename": (debugrename, [], _('debugrename FILE [REV]')), + "debugrename": (debugrename, + [('r', 'rev', '', _('revision to debug'))], + _('debugrename [-r REV] FILE')), "debugwalk": (debugwalk, walkopts, _('debugwalk [OPTION]... [FILE]...')), "^diff": (diff, diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -291,11 +291,10 @@ class filectx(object): # sort by revision (per file) which is a topological order visit = [] - files.reverse() for f in files: - fn = [(n._filerev, n) for n in needed.keys() if n._path == f] - fn.sort() + fn = [(n.rev(), n) for n in needed.keys() if n._path == f] visit.extend(fn) + visit.sort() hist = {} for r, f in visit: diff --git a/tests/test-annotate b/tests/test-annotate --- a/tests/test-annotate +++ b/tests/test-annotate @@ -76,3 +76,19 @@ hg annotate -nf b echo % linkrev vs rev hg annotate -r tip a + +# test issue 589 +# annotate was crashing when trying to --follow something +# like A -> B -> A +echo % generate ABA rename configuration +echo foo > foo +hg add foo +hg ci -m addfoo +hg rename foo bar +hg ci -m renamefoo +hg rename bar foo +hg ci -m renamebar + +echo % annotate after ABA with follow +hg annotate --follow foo + diff --git a/tests/test-annotate.out b/tests/test-annotate.out --- a/tests/test-annotate.out +++ b/tests/test-annotate.out @@ -52,3 +52,6 @@ 7 b: d 0: a 1: a 1: a +% generate ABA rename configuration +% annotate after ABA with follow +foo: foo diff --git a/tests/test-debugrename b/tests/test-debugrename new file mode 100755 --- /dev/null +++ b/tests/test-debugrename @@ -0,0 +1,17 @@ +#!/bin/sh + +hg init +echo a > a +hg ci -Am t + +hg mv a b +hg ci -Am t1 +hg debugrename b + +hg mv b a +hg ci -Am t2 +hg debugrename a + +echo % test with --rev +hg debugrename --rev 1 b + diff --git a/tests/test-debugrename.out b/tests/test-debugrename.out new file mode 100644 --- /dev/null +++ b/tests/test-debugrename.out @@ -0,0 +1,5 @@ +adding a +b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 +a renamed from b:9a263dd772e0159ddfa70fb8a448bb6c7ec8c69f +% test with --rev +b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3