Patchwork D11363: dirstate-item: have all the logic go through the v1_ accessors

login
register
mail settings
Submitter phabricator
Date Aug. 27, 2021, 2:49 p.m.
Message ID <differential-rev-PHID-DREV-fiqgiiidrcwjmggrfwr5-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49677/
State Superseded
Headers show

Comments

phabricator - Aug. 27, 2021, 2:49 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We are about to change the internal attribute. Having all the logic using the
  old "legacy" accessors will help to have a smooth transition.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS




To: marmoute, #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
@@ -225,15 +225,15 @@ 
 
     @property
     def mode(self):
-        return self._mode
+        return self.v1_mode()
 
     @property
     def size(self):
-        return self._size
+        return self.v1_size()
 
     @property
     def mtime(self):
-        return self._mtime
+        return self.v1_mtime()
 
     @property
     def state(self):
@@ -248,17 +248,17 @@ 
         dirstatev1 format. It would make sense to ultimately deprecate it in
         favor of the more "semantic" attributes.
         """
-        return self._state
+        return self.v1_state()
 
     @property
     def tracked(self):
         """True is the file is tracked in the working copy"""
-        return self._state in b"nma"
+        return self.v1_state() in b"nma"
 
     @property
     def added(self):
         """True if the file has been added"""
-        return self._state == b'a'
+        return self.v1_state() == b'a'
 
     @property
     def merged(self):
@@ -266,7 +266,7 @@ 
 
         Should only be set if a merge is in progress in the dirstate
         """
-        return self._state == b'm'
+        return self.v1_state() == b'm'
 
     @property
     def from_p2(self):
@@ -276,7 +276,7 @@ 
 
         Should only be set if a merge is in progress in the dirstate
         """
-        return self._state == b'n' and self._size == FROM_P2
+        return self.v1_state() == b'n' and self.v1_size() == FROM_P2
 
     @property
     def from_p2_removed(self):
@@ -285,12 +285,12 @@ 
         This property seems like an abstraction leakage and should probably be
         dealt in this class (or maybe the dirstatemap) directly.
         """
-        return self._state == b'r' and self._size == FROM_P2
+        return self.v1_state() == b'r' and self.v1_size() == FROM_P2
 
     @property
     def removed(self):
         """True if the file has been removed"""
-        return self._state == b'r'
+        return self.v1_state() == b'r'
 
     @property
     def merged_removed(self):
@@ -299,7 +299,7 @@ 
         This property seems like an abstraction leakage and should probably be
         dealt in this class (or maybe the dirstatemap)  directly.
         """
-        return self._state == b'r' and self._size == NONNORMAL
+        return self.v1_state() == b'r' and self.v1_size() == NONNORMAL
 
     @property
     def dm_nonnormal(self):
@@ -307,7 +307,7 @@ 
 
         There is no reason for any code, but the dirstatemap one to use this.
         """
-        return self.state != b'n' or self.mtime == AMBIGUOUS_TIME
+        return self.v1_state() != b'n' or self.v1_mtime() == AMBIGUOUS_TIME
 
     @property
     def dm_otherparent(self):
@@ -315,7 +315,7 @@ 
 
         There is no reason for any code, but the dirstatemap one to use this.
         """
-        return self._size == FROM_P2
+        return self.v1_size() == FROM_P2
 
     def v1_state(self):
         """return a "state" suitable for v1 serialization"""
@@ -335,7 +335,7 @@ 
 
     def need_delay(self, now):
         """True if the stored mtime would be ambiguous with the current time"""
-        return self._state == b'n' and self._mtime == now
+        return self.v1_state() == b'n' and self.v1_mtime() == now
 
 
 def gettype(q):