changeset 4819:9797124581c9

merge: fix adding untracked files on directory rename (issue612) Fix from Brendan Added test case
author Matt Mackall <mpm@selenic.com>
date Thu, 05 Jul 2007 16:01:07 -0500
parents 8808ea7da86b
children 8706e75e6431
files mercurial/merge.py tests/test-issue612 tests/test-issue612.out
diffstat 3 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Jul 05 13:34:18 2007 -0500
+++ b/mercurial/merge.py	Thu Jul 05 16:01:07 2007 -0500
@@ -478,6 +478,9 @@
                     repo.dirstate.forget([f])
         elif m == "d": # directory rename
             f2, fd, flag = a[2:]
+            if not f2 and f not in repo.dirstate:
+                # untracked file moved
+                continue
             if branchmerge:
                 repo.dirstate.update([fd], 'a')
                 if f:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-issue612	Thu Jul 05 16:01:07 2007 -0500
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+mkdir t
+cd t
+
+hg init
+mkdir src
+echo a > src/a.c
+hg ci -Ama -d "10000000 0"
+
+hg mv src source
+hg ci -Ammove -d "1000000 0"
+
+hg co -C 0
+echo new > src/a.c
+echo compiled > src/a.o
+hg ci -mupdate -d "1000000 0"
+
+hg st
+
+hg merge
+
+hg st
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-issue612.out	Thu Jul 05 16:01:07 2007 -0500
@@ -0,0 +1,11 @@
+adding src/a.c
+copying src/a.c to source/a.c
+removing src/a.c
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+? src/a.o
+merging src/a.c and source/a.c
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+M source/a.c
+R src/a.c
+? source/a.o