diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
index 8f452fecd0a48104d666ec234be29e9ec60593d6_bWVyY3VyaWFsL2NtZHV0aWwucHk=..e8d6261513b99ea73c12ef3da8900d79d17bf430_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644
--- 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,8 +3370,8 @@
         # 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:
@@ -3370,8 +3374,8 @@
                 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