From patchwork Fri Oct 1 09:42:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11541: dirstate-item: use item's property instead of `state` in revert From: phabricator X-Patchwork-Id: 49867 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 1 Oct 2021 09:42:52 +0000 marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11541 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3352,7 +3352,11 @@ for f in localchanges: src = repo.dirstate.copied(f) # XXX should we check for rename down to target node? - if src and src not in names and repo.dirstate[src] == b'r': + if ( + src + and src not in names + and repo.dirstate.get_entry(src).removed + ): dsremoved.add(src) names[src] = True @@ -3366,12 +3370,12 @@ # distinguish between file to forget and the other added = set() for abs in dsadded: - if repo.dirstate[abs] != b'a': + if not repo.dirstate.get_entry(abs).added: added.add(abs) dsadded -= added for abs in deladded: - if repo.dirstate[abs] == b'a': + if repo.dirstate.get_entry(abs).added: dsadded.add(abs) deladded -= dsadded