Mercurial > hg
changeset 7689:d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 25 Jan 2009 18:55:29 +0100 |
parents | 011e69b96c69 |
children | 1574c2704b11 dd970a311ea8 |
files | mercurial/localrepo.py tests/test-rename-after-merge tests/test-rename-after-merge.out |
diffstat | 3 files changed, 56 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Jan 21 11:15:47 2009 -0600 +++ b/mercurial/localrepo.py Sun Jan 25 18:55:29 2009 +0100 @@ -706,8 +706,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 Wed Jan 21 11:15:47 2009 -0600 +++ b/tests/test-rename-after-merge Sun Jan 25 18:55:29 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 Wed Jan 21 11:15:47 2009 -0600 +++ b/tests/test-rename-after-merge.out Sun Jan 25 18:55:29 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)