diff -r 119b9c8db94d -r a4443f66be6a mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py Tue Jul 13 13:04:49 2021 +0200 +++ b/mercurial/pure/parsers.py Tue Jul 13 13:06:50 2021 +0200 @@ -67,6 +67,20 @@ self._size = size self._mtime = mtime + @classmethod + def from_v1_data(cls, state, mode, size, mtime): + """Build a new DirstateItem object from V1 data + + Since the dirstate-v1 format is frozen, the signature of this function + is not expected to change, unlike the __init__ one. + """ + return cls( + state=state, + mode=mode, + size=size, + mtime=mtime, + ) + def __getitem__(self, idx): if idx == 0 or idx == -4: msg = b"do not use item[x], use item.state" @@ -546,7 +560,7 @@ if b'\0' in f: f, c = f.split(b'\0') copymap[f] = c - dmap[f] = DirstateItem(*e[:4]) + dmap[f] = DirstateItem.from_v1_data(*e[:4]) return parents