# HG changeset patch # User Pierre-Yves David # Date 1409358323 -7200 # Node ID 5e16fe6fdd32124c3295db5ec40b076084cc5bd4 # Parent bcab7bc7280e1a4ecf9e2c7f3600caac40fd0a1b revert: add a `drop` action This prevents the need for a try except in the `_performrevert` code. diff -r bcab7bc7280e -r 5e16fe6fdd32 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat Aug 30 02:23:25 2014 +0200 +++ b/mercurial/cmdutil.py Sat Aug 30 02:25:23 2014 +0200 @@ -2613,6 +2613,7 @@ actions = {'revert': ([], _('reverting %s\n')), 'add': ([], _('adding %s\n')), 'remove': ([], _('removing %s\n')), + 'drop': ([], _('removing %s\n')), 'forget': ([], _('forgetting %s\n')), 'undelete': ([], _('undeleting %s\n')), 'noop': (None, _('no changes needed to %s\n')), @@ -2642,7 +2643,7 @@ # Added in working directory (dsadded, actions['forget'], discard), # Added since target but file is missing in working directory - (deladded, actions['remove'], discard), + (deladded, actions['drop'], discard), # Removed since target, before working copy parent (removed, actions['add'], discard), # Same as `removed` but an unknown file exists at the same path @@ -2721,10 +2722,10 @@ repo.dirstate.drop(f) for f in actions['remove'][0]: audit_path(f) - try: - util.unlinkpath(repo.wjoin(f)) - except OSError: - pass + util.unlinkpath(repo.wjoin(f)) + repo.dirstate.remove(f) + for f in actions['drop'][0]: + audit_path(f) repo.dirstate.remove(f) normal = None