Mercurial > hg-stable
changeset 47664:119b9c8db94d
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 13 Jul 2021 13:04:49 +0200 |
parents | 6f8d6dd32e61 |
children | a4443f66be6a |
files | mercurial/pure/parsers.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Thu Jul 08 10:28:20 2021 +0200 +++ b/mercurial/pure/parsers.py Tue Jul 13 13:04:49 2021 +0200 @@ -44,7 +44,7 @@ AMBIGUOUS_TIME = -1 -@attr.s(slots=True) +@attr.s(slots=True, init=False) class DirstateItem(object): """represent a dirstate entry @@ -61,6 +61,12 @@ _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"