# HG changeset patch # User Pierre-Yves David # Date 1409358205 -7200 # Node ID bcab7bc7280e1a4ecf9e2c7f3600caac40fd0a1b # Parent 0d57bf80c7cbf8ac497ef2727953be13c230e5be revert: explicitly track added but deleted file Added + deleted file are files that need to be untracked from the dirstate but that are already missing on disk. The current `_performrevert` code is handling that with exception catching. We will be able to do better with a dedicated set. diff -r 0d57bf80c7cb -r bcab7bc7280e mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Sep 01 12:36:48 2014 +0200 +++ b/mercurial/cmdutil.py Sat Aug 30 02:23:25 2014 +0200 @@ -2523,9 +2523,8 @@ smf = set(mf) # determine the exact nature of the deleted changesets - _deletedadded = _deleted - smf - deleted = _deleted - _deletedadded - added |= _deletedadded + deladded = _deleted - smf + deleted = _deleted - deladded # We need to account for the state of file in the dirstate # @@ -2586,6 +2585,11 @@ added.add(abs) dsadded -= added + for abs in deladded: + if repo.dirstate[abs] == 'a': + dsadded.add(abs) + deladded -= dsadded + # For files marked as removed, we check if an unknown file is present at # the same path. If a such file exists it may need to be backed up. # Making the distinction at this stage helps have simpler backup @@ -2637,6 +2641,8 @@ (added, actions['remove'], discard), # Added in working directory (dsadded, actions['forget'], discard), + # Added since target but file is missing in working directory + (deladded, actions['remove'], discard), # Removed since target, before working copy parent (removed, actions['add'], discard), # Same as `removed` but an unknown file exists at the same path