Patchwork D11660: dirstate-v2: Use attributes as intended instead of properties in v2_data()

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2021, 1:05 p.m.
Message ID <differential-rev-PHID-DREV-dvh3pg4xiaafxug26met-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49984/
State Superseded
Headers show

Comments

phabricator - Oct. 14, 2021, 1:05 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The property return other integer values instead of None, so `is not None`
  does not work.
  
  This fixes test-dirstate-race.t in pure-Python mode, which currently fails
  on the default branch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -322,15 +322,15 @@ 
             flags |= DIRSTATE_V2_P1_TRACKED
         if self._p2_info:
             flags |= DIRSTATE_V2_P2_INFO
-        if self.mode is not None and self.size is not None:
+        if self._mode is not None and self._size is not None:
             flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE
             if self.mode & stat.S_IXUSR:
                 flags |= DIRSTATE_V2_MODE_EXEC_PERM
             if stat.S_ISLNK(self.mode):
                 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
-        if self.mtime is not None:
+        if self._mtime is not None:
             flags |= DIRSTATE_V2_HAS_MTIME
-        return (flags, self.size or 0, self.mtime or 0)
+        return (flags, self._size or 0, self._mtime or 0)
 
     def v1_state(self):
         """return a "state" suitable for v1 serialization"""