changeset 47566:3df817387ea3

parsers: move DirstateItem to attr.s This is the followup I requested on D10949 - it was easy, so I just did it. Differential Revision: https://phab.mercurial-scm.org/D11030
author Augie Fackler <augie@google.com>
date Thu, 08 Jul 2021 17:09:57 -0400
parents 00ae1fb6c459
children 7a15dea6d303
files mercurial/pure/parsers.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Fri Jul 02 11:44:13 2021 -0700
+++ b/mercurial/pure/parsers.py	Thu Jul 08 17:09:57 2021 -0400
@@ -14,6 +14,7 @@
     nullrev,
     sha1nodeconstants,
 )
+from ..thirdparty import attr
 from .. import (
     error,
     pycompat,
@@ -43,6 +44,7 @@
 AMBIGUOUS_TIME = -1
 
 
+@attr.s(slots=True)
 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: