Patchwork D11030: parsers: move DirstateItem to attr.s

login
register
mail settings
Submitter phabricator
Date July 8, 2021, 9:23 p.m.
Message ID <differential-rev-PHID-DREV-nolgmyichudgmat54yki-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49344/
State Superseded
Headers show

Comments

phabricator - July 8, 2021, 9:23 p.m.
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




To: durin42, #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
@@ -14,6 +14,7 @@ 
     nullrev,
     sha1nodeconstants,
 )
+from ..thirdparty import attr
 from .. import (
     error,
     pycompat,
@@ -43,6 +44,7 @@ 
 AMBIGUOUS_TIME = -1
 
 
+@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: