mercurial/scmutil.py
changeset 48103 8f452fecd0a4
parent 48098 ba79d99ec1ae
child 48105 207df24a31f6
--- a/mercurial/scmutil.py	Wed Sep 29 18:32:21 2021 +0200
+++ b/mercurial/scmutil.py	Wed Sep 29 18:36:12 2021 +0200
@@ -1455,10 +1455,11 @@
     """
     origsrc = repo.dirstate.copied(src) or src
     if dst == origsrc:  # copying back a copy?
-        if repo.dirstate[dst] not in b'mn' and not dryrun:
+        entry = repo.dirstate.get_entry(dst)
+        if (entry.added or not entry.tracked) and not dryrun:
             repo.dirstate.set_tracked(dst)
     else:
-        if repo.dirstate[origsrc] == b'a' and origsrc == src:
+        if repo.dirstate.get_entry(origsrc).added and origsrc == src:
             if not ui.quiet:
                 ui.warn(
                     _(
@@ -1467,7 +1468,7 @@
                     )
                     % (repo.pathto(origsrc, cwd), repo.pathto(dst, cwd))
                 )
-            if repo.dirstate[dst] in b'?r' and not dryrun:
+            if not repo.dirstate.get_entry(dst).tracked and not dryrun:
                 wctx.add([dst])
         elif not dryrun:
             wctx.copy(origsrc, dst)