mercurial/cmdutil.py
changeset 22185 afead12e724b
parent 22173 d3702a822241
child 22186 a89bc7833e0d
--- a/mercurial/cmdutil.py	Fri Aug 15 10:54:15 2014 -0500
+++ b/mercurial/cmdutil.py	Fri Aug 01 18:57:53 2014 -0700
@@ -2380,7 +2380,16 @@
         modified = set(changes[0])
         added    = set(changes[1])
         removed  = set(changes[2])
-        deleted  = set(changes[3])
+        _deleted  = set(changes[3])
+
+        # split between files known in target manifest and the others
+        smf = set(mf)
+
+        # determine the exact nature of the deleted changesets
+        _deletedadded = _deleted - smf
+        _deletedmodified = _deleted - _deletedadded
+        added |= _deletedadded
+        modified |= _deletedmodified
 
         # We need to account for the state of file in the dirstate
         #
@@ -2397,6 +2406,8 @@
             dsmodified = set(changes[0])
             dsadded    = set(changes[1])
             dsremoved  = set(changes[2])
+            dsadded |= _deletedadded
+            dsmodified |= _deletedmodified
 
         # if f is a rename, update `names` to also revert the source
         cwd = repo.getcwd()
@@ -2413,17 +2424,12 @@
                 return _('forgetting %s\n')
             return _('removing %s\n')
 
-        # split between files known in target manifest and the others
-        smf = set(mf)
-
         missingmodified = dsmodified - smf
         dsmodified -= missingmodified
         missingadded = dsadded - smf
         dsadded -= missingadded
         missingremoved = dsremoved - smf
         dsremoved -= missingremoved
-        missingdeleted = deleted - smf
-        deleted -= missingdeleted
 
         # action to be actually performed by revert
         # (<list of file>, message>) tuple
@@ -2443,8 +2449,6 @@
             (missingadded,     (actions['remove'],   False)),
             (dsremoved,        (actions['undelete'], True)),
             (missingremoved,   (None,                False)),
-            (deleted,          (actions['revert'],   False)),
-            (missingdeleted,   (actions['remove'],   False)),
             )
 
         for abs, (rel, exact) in sorted(names.items()):