From patchwork Thu Jul 8 21:23:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11030: parsers: move DirstateItem to attr.s From: phabricator X-Patchwork-Id: 49344 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 8 Jul 2021 21:23:20 +0000 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 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: