Merge with crew-stable
authorPatrick Mezard <pmezard@gmail.com>
Sun, 25 Jan 2009 18:58:12 +0100
changeset 7690 1574c2704b11
parent 7688 9e70287086c7 (current diff)
parent 7689 d821ea464465 (diff)
child 7691 bcdc2fe3fd07
Merge with crew-stable
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sun Jan 25 15:11:43 2009 +0800
+++ b/mercurial/localrepo.py	Sun Jan 25 18:58:12 2009 +0100
@@ -733,8 +733,8 @@
             nfp = fp2
 
             if manifest2: # branch merge
-                if fp2 == nullid: # copied on remote side
-                    if fp1 != nullid or cf in manifest2:
+                if fp2 == nullid or cr is None: # copied on remote side
+                    if cf in manifest2:
                         cr = manifest2[cf]
                         nfp = fp1
 
--- a/tests/test-rename-after-merge	Sun Jan 25 15:11:43 2009 +0800
+++ b/tests/test-rename-after-merge	Sun Jan 25 18:58:12 2009 +0100
@@ -32,3 +32,37 @@
 echo % rename back c as b
 hg mv c b
 hg st
+cd ..
+
+# Test issue 1476: renaming a first parent file into
+# another first parent file while none of them belong to
+# the second parent was broken
+echo % test issue 1476
+hg init repo1476
+cd repo1476
+echo a > a
+hg ci -Am adda
+echo b1 > b1
+echo b2 > b2
+hg ci -Am changea
+hg up -C 0
+echo c1 > c1
+echo c2 > c2
+hg ci -Am addcandd
+echo % merge heads
+hg merge
+hg mv -Af c1 c2
+echo % commit issue 1476
+hg ci -m merge
+hg log -r tip -C -v | grep copies
+hg rollback
+hg up -C .
+echo % merge heads again
+hg merge
+hg mv -Af b1 b2
+echo % commit issue 1476 with a rename on the other side
+hg ci -m merge
+hg log -r tip -C -v | grep copies
+
+
+
--- a/tests/test-rename-after-merge.out	Sun Jan 25 15:11:43 2009 +0800
+++ b/tests/test-rename-after-merge.out	Sun Jan 25 18:58:12 2009 +0100
@@ -21,3 +21,23 @@
 R b
 % rename back c as b
 M b
+% test issue 1476
+adding a
+adding b1
+adding b2
+0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+adding c1
+adding c2
+created new head
+% merge heads
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% commit issue 1476
+copies:      c2 (c1)
+rolling back last transaction
+2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+% merge heads again
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% commit issue 1476 with a rename on the other side
+copies:      b2 (b1)