--- a/hgext/rebase.py Sun Apr 03 23:47:17 2011 +0900
+++ b/hgext/rebase.py Sun Mar 27 13:34:20 2011 +0200
@@ -270,7 +270,7 @@
if k in m1:
if v in m1 or v in m2:
repo.dirstate.copy(v, k)
- if v in m2 and v not in m1:
+ if v in m2 and v not in m1 and k in m2:
repo.dirstate.remove(v)
def concludenode(repo, rev, p1, p2, commitmsg=None, extrafn=None):
--- a/tests/test-rebase-rename.t Sun Apr 03 23:47:17 2011 +0900
+++ b/tests/test-rebase-rename.t Sun Mar 27 13:34:20 2011 +0200
@@ -119,3 +119,52 @@
copy from a
copy to a-copied
+ $ cd ..
+
+
+Test rebase across repeating renames:
+
+ $ hg init repo
+
+ $ cd repo
+
+ $ echo testing > file1.txt
+ $ hg add file1.txt
+ $ hg ci -m "Adding file1"
+
+ $ hg rename file1.txt file2.txt
+ $ hg ci -m "Rename file1 to file2"
+
+ $ echo Unrelated change > unrelated.txt
+ $ hg add unrelated.txt
+ $ hg ci -m "Unrelated change"
+
+ $ hg rename file2.txt file1.txt
+ $ hg ci -m "Rename file2 back to file1"
+
+ $ hg update -r -2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+ $ echo Another unrelated change >> unrelated.txt
+ $ hg ci -m "Another unrelated change"
+ created new head
+
+ $ hg tglog
+ @ 4: 'Another unrelated change'
+ |
+ | o 3: 'Rename file2 back to file1'
+ |/
+ o 2: 'Unrelated change'
+ |
+ o 1: 'Rename file1 to file2'
+ |
+ o 0: 'Adding file1'
+
+
+ $ hg rebase -s 4 -d 3
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-backup.hg (glob)
+
+ $ hg diff --stat -c .
+ unrelated.txt | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+