--- a/mercurial/commands.py Tue Jun 19 08:51:34 2007 +0200
+++ b/mercurial/commands.py Wed Jun 20 00:22:51 2007 +0200
@@ -2743,7 +2743,9 @@
"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,
--- a/mercurial/context.py Tue Jun 19 08:51:34 2007 +0200
+++ b/mercurial/context.py Wed Jun 20 00:22:51 2007 +0200
@@ -291,11 +291,10 @@
# 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:
--- a/tests/test-annotate Tue Jun 19 08:51:34 2007 +0200
+++ b/tests/test-annotate Wed Jun 20 00:22:51 2007 +0200
@@ -76,3 +76,19 @@
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
+
--- a/tests/test-annotate.out Tue Jun 19 08:51:34 2007 +0200
+++ b/tests/test-annotate.out Wed Jun 20 00:22:51 2007 +0200
@@ -52,3 +52,6 @@
0: a
1: a
1: a
+% generate ABA rename configuration
+% annotate after ABA with follow
+foo: foo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-debugrename Wed Jun 20 00:22:51 2007 +0200
@@ -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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-debugrename.out Wed Jun 20 00:22:51 2007 +0200
@@ -0,0 +1,5 @@
+adding a
+b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
+a renamed from b:9a263dd772e0159ddfa70fb8a448bb6c7ec8c69f
+% test with --rev
+b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3