Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/deltas.py @ 47264:b876f0bf7366
revlog: introduce a plain compression mode
That mode is simple it means the chunk contains uncompressed data and can be
used directly.
Differential Revision: https://phab.mercurial-scm.org/D10650
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 19:46:25 +0200 |
parents | d4ba4d51f85f |
children | 34cc102c73f5 |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Mon May 03 20:22:34 2021 +0200 +++ b/mercurial/revlogutils/deltas.py Mon May 03 19:46:25 2021 +0200 @@ -553,6 +553,24 @@ snapshotdepth = attr.ib() +def drop_u_compression(delta): + """turn into a "u" (no-compression) into no-compression without header + + This is useful for revlog format that has better compression method. + """ + assert delta.data[0] == b'u', delta.data[0] + return _deltainfo( + delta.distance, + delta.deltalen - 1, + (b'', delta.data[1]), + delta.base, + delta.chainbase, + delta.chainlen, + delta.compresseddeltalen, + delta.snapshotdepth, + ) + + def isgooddeltainfo(revlog, deltainfo, revinfo): """Returns True if the given delta is good. Good means that it is within the disk span, disk size, and chain length bounds that we know to be