Patchwork D10965: dirstate: stop using `oldstate` in `dirstate._addpath`

login
register
mail settings
Submitter phabricator
Date July 4, 2021, 9:54 p.m.
Message ID <differential-rev-PHID-DREV-j2hvozxpfk52zecgc5ov-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49278/
State Superseded
Headers show

Comments

phabricator - July 4, 2021, 9:54 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We don't need to pass the oldstate around, so lets use the new property
  instead.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10965

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -451,7 +451,8 @@ 
         possibly_dirty=False,
     ):
         oldstate = self[f]
-        if state == b'a' or oldstate == b'r':
+        entry = self._map.get(f)
+        if state == b'a' or entry is not None and entry.removed:
             scmutil.checkfilename(f)
             if self._map.hastrackeddir(f):
                 msg = _(b'directory %r already in dirstate')