changeset 4640:178778ca648f

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Wed, 20 Jun 2007 00:22:51 +0200
parents 63b9d2deed48 (current diff) c7371aa0c153 (diff)
children 7c5428853566
files mercurial/commands.py mercurial/context.py tests/test-annotate tests/test-debugrename
diffstat 6 files changed, 46 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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:
--- 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
+
--- 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
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
+
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