From patchwork Thu Aug 14 21:35:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,6] revert: process removed files missing in target as clean From: Pierre-Yves David X-Patchwork-Id: 5398 Message-Id: To: mercurial-devel@selenic.com Cc: Pierre-Yves David Date: Thu, 14 Aug 2014 14:35:57 -0700 # HG changeset patch # User Pierre-Yves David # Date 1406942867 25200 # Fri Aug 01 18:27:47 2014 -0700 # Node ID cfbc006d15a6f015d76f5f834856bbbc5cd73cdd # Parent 1e832b11013b1c024a2be8976681e3fef0e8ea16 revert: process removed files missing in target as clean If a file does not exist in target and is marked as removed in the dirstate, we can mark it as clean. There is no changes needed to revert it. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2420,12 +2420,12 @@ def revert(ui, repo, ctx, parents, *pats missingmodified = dsmodified - smf dsmodified -= missingmodified missingadded = dsadded - smf dsadded -= missingadded - missingremoved = dsremoved - smf - dsremoved -= missingremoved + clean |= dsremoved - smf + dsremoved -= clean # action to be actually performed by revert # (, message>) tuple actions = {'revert': ([], _('reverting %s\n')), 'add': ([], _('adding %s\n')), @@ -2440,11 +2440,10 @@ def revert(ui, repo, ctx, parents, *pats (dsmodified, (actions['revert'], True)), (missingmodified, (actions['remove'], True)), (dsadded, (actions['revert'], True)), (missingadded, (actions['remove'], False)), (dsremoved, (actions['undelete'], True)), - (missingremoved, (None, False)), (clean, (None, False)), ) for abs, (rel, exact) in sorted(names.items()): # hash on file in target manifest (or None if missing from target)