mercurial/patch.py
branchstable
changeset 16112 d7829b2ecf32
parent 15971 089ee59a8658
child 16121 ccba74472af2
--- a/mercurial/patch.py	Thu Feb 16 12:56:48 2012 +0100
+++ b/mercurial/patch.py	Thu Feb 16 13:03:42 2012 +0100
@@ -475,9 +475,15 @@
         addremoved = set(self.changed)
         for src, dst in self.copied:
             scmutil.dirstatecopy(self.ui, self.repo, wctx, src, dst)
-            addremoved.discard(src)
-        if (not self.similarity) and self.removed:
+        if self.removed:
             wctx.forget(sorted(self.removed))
+            for f in self.removed:
+                if f not in self.repo.dirstate:
+                    # File was deleted and no longer belongs to the
+                    # dirstate, it was probably marked added then
+                    # deleted, and should not be considered by
+                    # addremove().
+                    addremoved.discard(f)
         if addremoved:
             cwd = self.repo.getcwd()
             if cwd: