mercurial/merge.py
changeset 6242 a375ffc2aa1b
parent 6211 f89fd07fc51d
child 6256 69c75d063c7a
--- a/mercurial/merge.py	Wed Mar 12 15:33:43 2008 -0700
+++ b/mercurial/merge.py	Wed Mar 12 15:44:08 2008 -0700
@@ -29,7 +29,7 @@
                              % (fn, folded[fold]))
         folded[fold] = fn
 
-def forgetremoved(wctx, mctx):
+def forgetremoved(wctx, mctx, branchmerge):
     """
     Forget removed files
 
@@ -38,13 +38,23 @@
     then we need to remove it from the dirstate, to prevent the
     dirstate from listing the file when it is no longer in the
     manifest.
+
+    If we're merging, and the other revision has removed a file
+    that is not present in the working directory, we need to mark it
+    as removed.
     """
 
     action = []
     man = mctx.manifest()
-    for f in wctx.deleted() + wctx.removed():
+    state = branchmerge and 'r' or 'f'
+    for f in wctx.deleted():
         if f not in man:
-            action.append((f, "f"))
+            action.append((f, state))
+
+    if not branchmerge:
+        for f in wctx.removed():
+            if f not in man:
+                action.append((f, "f"))
 
     return action
 
@@ -608,8 +618,7 @@
             checkunknown(wc, p2)
         if not util.checkfolding(repo.path):
             checkcollision(p2)
-        if not branchmerge:
-            action += forgetremoved(wc, p2)
+        action += forgetremoved(wc, p2, branchmerge)
         action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
 
         ### apply phase