Mercurial > hg
changeset 22491:5e16fe6fdd32
revert: add a `drop` action
This prevents the need for a try except in the `_performrevert` code.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 30 Aug 2014 02:25:23 +0200 |
parents | bcab7bc7280e |
children | 14f6cebfcb8a |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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