[Request] [+- ] D11363: dirstate-item: have all the logic go through the v1_ accessors

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Aug 27 14:49:24 UTC 2021


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

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):



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210827/90a5903c/attachment-0001.html>


More information about the Mercurial-patches mailing list