# HG changeset patch # User Matt Mackall # Date 1186075750 18000 # Node ID 8d9bdcbb2b1852d2507cbb7e5d922f549f73f19d # Parent a3d6de2838de489c8ac5214a808a304f799861d1 merge: avoid double deletion mentioned in issue636 diff -r a3d6de2838de -r 8d9bdcbb2b18 mercurial/merge.py --- a/mercurial/merge.py Thu Aug 02 13:03:25 2007 +0200 +++ b/mercurial/merge.py Thu Aug 02 12:29:10 2007 -0500 @@ -415,10 +415,10 @@ updated += 1 else: merged += 1 - if f != fd and move: + util.set_exec(repo.wjoin(fd), "x" in flags) + if f != fd and move and util.lexists(repo.wjoin(f)): repo.ui.debug(_("removing %s\n") % f) os.unlink(repo.wjoin(f)) - util.set_exec(repo.wjoin(fd), "x" in flags) elif m == "g": # get flags = a[2] repo.ui.note(_("getting %s\n") % f) diff -r a3d6de2838de -r 8d9bdcbb2b18 tests/test-copy-move-merge --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-copy-move-merge Thu Aug 02 12:29:10 2007 -0500 @@ -0,0 +1,30 @@ +#!/bin/sh + +mkdir t +cd t +hg init + +echo 1 > a +hg ci -qAm "first" -d "1000000 0" + +hg cp a b +hg mv a c +echo 2 >> b +echo 2 >> c + +hg ci -qAm "second" -d "1000000 0" + +hg co -C 0 + +echo 0 > a +echo 1 >> a + +hg ci -qAm "other" -d "1000000 0" + +hg merge --debug + +echo "-- b --" +cat b + +echo "-- c --" +cat c diff -r a3d6de2838de -r 8d9bdcbb2b18 tests/test-copy-move-merge.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-copy-move-merge.out Thu Aug 02 12:29:10 2007 -0500 @@ -0,0 +1,23 @@ +1 files updated, 0 files merged, 2 files removed, 0 files unresolved +resolving manifests + overwrite None partial False + ancestor 583c7b748052 local fb3948d97f07+ remote 40da226db0f0 + a: remote moved to c -> m + a: remote moved to b -> m +copying a to b +copying a to c +merging a and b +my a@fb3948d97f07+ other b@40da226db0f0 ancestor a@583c7b748052 +removing a +merging a and c +my a@fb3948d97f07+ other c@40da226db0f0 ancestor a@583c7b748052 +0 files updated, 2 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +-- b -- +0 +1 +2 +-- c -- +0 +1 +2