changeset 48114:304267b077de

dirstate-item: use item's property instead of `state` in copy Differential Revision: https://phab.mercurial-scm.org/D11539
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 18:32:21 +0200
parents 78e66649cdb3
children 8f452fecd0a4
files mercurial/cmdutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Sep 29 17:52:39 2021 +0200
+++ b/mercurial/cmdutil.py	Wed Sep 29 18:32:21 2021 +0200
@@ -1642,7 +1642,9 @@
         reltarget = repo.pathto(abstarget, cwd)
         target = repo.wjoin(abstarget)
         src = repo.wjoin(abssrc)
-        state = repo.dirstate[abstarget]
+        entry = repo.dirstate.get_entry(abstarget)
+
+        already_commited = entry.tracked and not entry.added
 
         scmutil.checkportable(ui, abstarget)
 
@@ -1672,9 +1674,9 @@
                 exists = False
                 samefile = True
 
-        if not after and exists or after and state in b'mn':
+        if not after and exists or after and already_commited:
             if not opts[b'force']:
-                if state in b'mn':
+                if already_commited:
                     msg = _(b'%s: not overwriting - file already committed\n')
                     if after:
                         flags = b'--after --force'