changeset 48104:e8d6261513b9

dirstate-item: use item's property instead of `state` in revert Differential Revision: https://phab.mercurial-scm.org/D11541
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 18:37:20 +0200
parents 8f452fecd0a4
children 207df24a31f6
files mercurial/cmdutil.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Sep 29 18:36:12 2021 +0200
+++ b/mercurial/cmdutil.py	Wed Sep 29 18:37:20 2021 +0200
@@ -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