dirstate: don't fail when dropping a not-tracked file (issue3080) stable 2.0
authorMatt Mackall <mpm@selenic.com>
Tue, 01 Nov 2011 15:19:37 -0500
branchstable
changeset 15399 41453d55b481
parent 15398 474279be5add
child 15400 c23737b76030
dirstate: don't fail when dropping a not-tracked file (issue3080) Complex merges with divergent renames can cause a file to be 'moved' twice, causing dirstate.drop() to be called twice. Rather than try to ensure there are no unexpected corner cases where this can happen, we simply ignore drops of files that aren't tracked.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Tue Nov 01 12:25:54 2011 -0700
+++ b/mercurial/dirstate.py	Tue Nov 01 15:19:37 2011 -0500
@@ -370,9 +370,10 @@
 
     def drop(self, f):
         '''Drop a file from the dirstate'''
-        self._dirty = True
-        self._droppath(f)
-        del self._map[f]
+        if f in self._map:
+            self._dirty = True
+            self._droppath(f)
+            del self._map[f]
 
     def _normalize(self, path, isknown):
         normed = os.path.normcase(path)