# HG changeset patch # User Pierre-Yves David # Date 2014-08-30 00:09:53 # Node ID 1db04829bdc187ccf8a2cae3915b654b4ea68110 # Parent c0213f2cb942bed38b6b5468aeb1e5e2dde5a5b6 revert: distinguish between deleted file and locally modified Locally modified needs a backup while a deleted file cannot be backed up because there is no file to backup. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2425,9 +2425,8 @@ def revert(ui, repo, ctx, parents, *pats # determine the exact nature of the deleted changesets _deletedadded = _deleted - smf - _deletedmodified = _deleted - _deletedadded + deleted = _deleted - _deletedadded added |= _deletedadded - modified |= _deletedmodified # We need to account for the state of file in the dirstate # @@ -2541,6 +2540,8 @@ def revert(ui, repo, ctx, parents, *pats ## Sets that results that will change file on disk # Modified compared to target, no local change (modified, actions['revert'], discard), + # Modified compared to target, but local file is deleted + (deleted, actions['revert'], discard), # Modified compared to target, local change (dsmodified, actions['revert'], backup), # Added since target