# HG changeset patch # User Pierre-Yves David # Date 2014-06-24 15:53:22 # Node ID 0ad619c5e1a4e54e78518ac645f7d28fe17fb805 # Parent aee5385e4bae06a4e19be99f74dba9855b3c7434 revert: use "remove" information from both statuses Using status information against the target to make sure we are catching all files that need to be re-added. We still need to distinguish fresh removal because they use a different message. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2410,6 +2410,12 @@ def revert(ui, repo, ctx, parents, *pats dsadded |= _deletedadded dsmodified |= _deletedmodified + # only take into account for removes between wc and target + clean |= dsremoved - removed + dsremoved &= removed + # distinct between dirstate remove and other + removed -= dsremoved + # if f is a rename, update `names` to also revert the source cwd = repo.getcwd() for f in dsadded: @@ -2429,8 +2435,6 @@ def revert(ui, repo, ctx, parents, *pats dsmodified -= missingmodified missingadded = dsadded - smf dsadded -= missingadded - clean |= dsremoved - smf - dsremoved -= clean # action to be actually performed by revert # (, message>) tuple @@ -2448,6 +2452,7 @@ def revert(ui, repo, ctx, parents, *pats (missingmodified, (actions['remove'], True)), (dsadded, (actions['revert'], True)), (missingadded, (actions['remove'], False)), + (removed, (actions['add'], True)), (dsremoved, (actions['undelete'], True)), (clean, (None, False)), )