Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 47269:c4dbb7636a12
revlog: compress sidedata in `_writeentry`
When appropriate we store the sidedata in a compressed form.
Differential Revision: https://phab.mercurial-scm.org/D10655
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 23:14:48 +0200 |
parents | 87d057137f82 |
children | 07641bafa646 |
comparison
equal
deleted
inserted
replaced
47268:87d057137f82 | 47269:c4dbb7636a12 |
---|---|
2535 sidedata_compression_mode = COMP_MODE_INLINE | 2535 sidedata_compression_mode = COMP_MODE_INLINE |
2536 if sidedata and self.hassidedata: | 2536 if sidedata and self.hassidedata: |
2537 sidedata_compression_mode = COMP_MODE_PLAIN | 2537 sidedata_compression_mode = COMP_MODE_PLAIN |
2538 serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) | 2538 serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) |
2539 sidedata_offset = offset + deltainfo.deltalen | 2539 sidedata_offset = offset + deltainfo.deltalen |
2540 h, comp_sidedata = self.compress(serialized_sidedata) | |
2541 if ( | |
2542 h != b'u' | |
2543 and comp_sidedata[0:1] != b'\0' | |
2544 and len(comp_sidedata) < len(serialized_sidedata) | |
2545 ): | |
2546 assert not h | |
2547 if ( | |
2548 comp_sidedata[0:1] | |
2549 == self._docket.default_compression_header | |
2550 ): | |
2551 sidedata_compression_mode = COMP_MODE_DEFAULT | |
2552 serialized_sidedata = comp_sidedata | |
2553 else: | |
2554 sidedata_compression_mode = COMP_MODE_INLINE | |
2555 serialized_sidedata = comp_sidedata | |
2540 else: | 2556 else: |
2541 serialized_sidedata = b"" | 2557 serialized_sidedata = b"" |
2542 # Don't store the offset if the sidedata is empty, that way | 2558 # Don't store the offset if the sidedata is empty, that way |
2543 # we can easily detect empty sidedata and they will be no different | 2559 # we can easily detect empty sidedata and they will be no different |
2544 # than ones we manually add. | 2560 # than ones we manually add. |