# HG changeset patch # User Pierre-Yves David # Date 2021-07-13 11:04:49 # Node ID 119b9c8db94de6b733b467fc7fe3fcd460e042d5 # Parent 6f8d6dd32e6133e7765b32dd16db25e1128778c3 dirstate-item: use an explicit __init__ function instead of the attrs one For now, this is not doing anything special, however we plan to make it different in the future. So we start simple. Differential Revision: https://phab.mercurial-scm.org/D11117 diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -44,7 +44,7 @@ NONNORMAL = -1 AMBIGUOUS_TIME = -1 -@attr.s(slots=True) +@attr.s(slots=True, init=False) class DirstateItem(object): """represent a dirstate entry @@ -61,6 +61,12 @@ class DirstateItem(object): _size = attr.ib() _mtime = attr.ib() + def __init__(self, state, mode, size, mtime): + self._state = state + self._mode = mode + self._size = size + self._mtime = mtime + def __getitem__(self, idx): if idx == 0 or idx == -4: msg = b"do not use item[x], use item.state"