Mercurial > hg
diff mercurial/pure/parsers.py @ 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 | 1a6302427eb9 |
children | 7a4ba68f2373 |
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: