Mercurial > hg
diff mercurial/pure/parsers.py @ 47509:80dc1d452993
dirstate-entry: introduce dedicated accessors for v1 serialization
In the spirit of changing the content and storage of the dirstate entry, we add
new method that the code doing v1 serialisation can use.
Adding such method to the C object is quite trivial.
Differential Revision: https://phab.mercurial-scm.org/D10951
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 03 Jul 2021 04:01:17 +0200 |
parents | 67d11b0f659f |
children | 769037a279ec |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Sat Jul 03 03:55:23 2021 +0200 +++ b/mercurial/pure/parsers.py Sat Jul 03 04:01:17 2021 +0200 @@ -64,6 +64,22 @@ else: raise IndexError(idx) + def v1_state(self): + """return a "state" suitable for v1 serialization""" + return self._state + + def v1_mode(self): + """return a "mode" suitable for v1 serialization""" + return self._mode + + def v1_size(self): + """return a "size" suitable for v1 serialization""" + return self._size + + def v1_mtime(self): + """return a "mtime" suitable for v1 serialization""" + return self._mtime + def gettype(q): return int(q & 0xFFFF) @@ -450,7 +466,14 @@ if f in copymap: f = b"%s\0%s" % (f, copymap[f]) - e = _pack(b">cllll", e[0], e[1], e[2], e[3], len(f)) + e = _pack( + b">cllll", + e.v1_state(), + e.v1_mode(), + e.v1_size(), + e.v1_mtime(), + len(f), + ) write(e) write(f) return cs.getvalue()