mercurial/hg.py
changeset 408 3695fbd2c33b
parent 407 0e0d0670b2bc
child 412 40cfa2d0c088
--- a/mercurial/hg.py	Tue Jun 21 18:41:57 2005 -0800
+++ b/mercurial/hg.py	Tue Jun 21 18:48:28 2005 -0800
@@ -1011,6 +1011,10 @@
 
         (c, a, d, u) = self.diffdir(self.root)
 
+        # is this a jump, or a merge?  i.e. is there a linear path
+        # from p1 to p2?
+        linear_path = (pa == p1 or pa == p2)
+
         # resolve the manifest to determine which files
         # we care about merging
         self.ui.note("resolving manifests\n")
@@ -1031,6 +1035,14 @@
         for f in d:
             if f in mw: del mw[f]
 
+            # If we're jumping between revisions (as opposed to merging),
+            # and if neither the working directory nor the target rev has
+            # the file, 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 linear_path and f not in m2:
+                self.dirstate.forget((f,))
+
         for f, n in mw.iteritems():
             if f in m2:
                 s = 0
@@ -1117,7 +1129,7 @@
                 get[f] = merge[f][1]
             merge = {}
 
-        if pa == p1 or pa == p2:
+        if linear_path:
             # we don't need to do any magic, just jump to the new rev
             mode = 'n'
             p1, p2 = p2, nullid