D11030: parsers: move DirstateItem to attr.s

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Jul 8 21:23:20 UTC 2021


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

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -14,6 +14,7 @@
     nullrev,
     sha1nodeconstants,
 )
+from ..thirdparty import attr
 from .. import (
     error,
     pycompat,
@@ -43,6 +44,7 @@
 AMBIGUOUS_TIME = -1
 
 
+ at attr.s
 class DirstateItem(object):
     """represent a dirstate entry
 
@@ -54,13 +56,10 @@
     - mtime,
     """
 
-    __slot__ = ('_state', '_mode', '_size', '_mtime')
-
-    def __init__(self, state, mode, size, mtime):
-        self._state = state
-        self._mode = mode
-        self._size = size
-        self._mtime = mtime
+    _state = attr.ib()
+    _mode = attr.ib()
+    _size = attr.ib()
+    _mtime = attr.ib()
 
     def __getitem__(self, idx):
         if idx == 0 or idx == -4:



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


More information about the Mercurial-devel mailing list