Mercurial > public > mercurial-scm > hg
diff mercurial/revlog.py @ 47259:07641bafa646
revlog: compress sidedata when doing "post-pull" sidedata update
All path writing sidedata are now using compression (when appropriate).
Differential Revision: https://phab.mercurial-scm.org/D10656
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 23:40:05 +0200 |
parents | c4dbb7636a12 |
children | 80164d50ae3d |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 23:14:48 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 23:40:05 2021 +0200 @@ -3381,6 +3381,26 @@ serialized_sidedata = sidedatautil.serialize_sidedata( new_sidedata ) + + sidedata_compression_mode = COMP_MODE_INLINE + if serialized_sidedata and self.hassidedata: + sidedata_compression_mode = COMP_MODE_PLAIN + h, comp_sidedata = self.compress(serialized_sidedata) + if ( + h != b'u' + and comp_sidedata[0] != b'\0' + and len(comp_sidedata) < len(serialized_sidedata) + ): + assert not h + if ( + comp_sidedata[0] + == self._docket.default_compression_header + ): + sidedata_compression_mode = COMP_MODE_DEFAULT + serialized_sidedata = comp_sidedata + else: + sidedata_compression_mode = COMP_MODE_INLINE + serialized_sidedata = comp_sidedata if entry[8] != 0 or entry[9] != 0: # rewriting entries that already have sidedata is not # supported yet, because it introduces garbage data in the @@ -3395,6 +3415,7 @@ current_offset, len(serialized_sidedata), new_offset_flags, + sidedata_compression_mode, ) # the sidedata computation might have move the file cursors around