D11117: dirstate-item: use an explicit __init__ function instead of the attrs one

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 19 10:38:52 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  For now, this is not doing anything special, however we plan to make it different in the future. So we start simple.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -44,7 +44,7 @@
 AMBIGUOUS_TIME = -1
 
 
- at attr.s(slots=True)
+ at attr.s(slots=True, init=False)
 class DirstateItem(object):
     """represent a dirstate entry
 
@@ -61,6 +61,12 @@
     _size = attr.ib()
     _mtime = attr.ib()
 
+    def __init__(self, state, mode, size, mtime):
+        self._state = state
+        self._mode = mode
+        self._size = size
+        self._mtime = mtime
+
     def __getitem__(self, idx):
         if idx == 0 or idx == -4:
             msg = b"do not use item[x], use item.state"



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


More information about the Mercurial-devel mailing list