Patchwork D11539: dirstate-item: use item's property instead of `state` in copy

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2021, 9:42 a.m.
Message ID <differential-rev-PHID-DREV-qbhlz26rqg6s2wrljptu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49862/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2021, 9:42 a.m.
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/D11539

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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'