Mercurial > public > mercurial-scm > hg
comparison mercurial/pure/parsers.py @ 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 | 7a4ba68f2373 |
children | a4443f66be6a |
comparison
equal
deleted
inserted
replaced
47663:6f8d6dd32e61 | 47664:119b9c8db94d |
---|---|
42 | 42 |
43 # a special value used internally for `time` if the time is ambigeous | 43 # a special value used internally for `time` if the time is ambigeous |
44 AMBIGUOUS_TIME = -1 | 44 AMBIGUOUS_TIME = -1 |
45 | 45 |
46 | 46 |
47 @attr.s(slots=True) | 47 @attr.s(slots=True, init=False) |
48 class DirstateItem(object): | 48 class DirstateItem(object): |
49 """represent a dirstate entry | 49 """represent a dirstate entry |
50 | 50 |
51 It contains: | 51 It contains: |
52 | 52 |
58 | 58 |
59 _state = attr.ib() | 59 _state = attr.ib() |
60 _mode = attr.ib() | 60 _mode = attr.ib() |
61 _size = attr.ib() | 61 _size = attr.ib() |
62 _mtime = attr.ib() | 62 _mtime = attr.ib() |
63 | |
64 def __init__(self, state, mode, size, mtime): | |
65 self._state = state | |
66 self._mode = mode | |
67 self._size = size | |
68 self._mtime = mtime | |
63 | 69 |
64 def __getitem__(self, idx): | 70 def __getitem__(self, idx): |
65 if idx == 0 or idx == -4: | 71 if idx == 0 or idx == -4: |
66 msg = b"do not use item[x], use item.state" | 72 msg = b"do not use item[x], use item.state" |
67 util.nouideprecwarn(msg, b'6.0', stacklevel=2) | 73 util.nouideprecwarn(msg, b'6.0', stacklevel=2) |