changeset 6242:a375ffc2aa1b

merge: fix handling of deleted files
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Wed, 12 Mar 2008 15:44:08 -0700
parents a718e66836e8
children 437eef39458d 7f4257b5cbfc
files mercurial/merge.py
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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