# HG changeset patch # User Pierre-Yves David # Date 1620078305 -7200 # Node ID de63be070e029ba0fef922a4ec7dbd2a435ca85e # Parent 78230d036e5d33c5bc2eebc0080bf6f467885e0e revlog: simplify entry update logic in `rewrite_sidedata` We don't need to rebuild the full entry. So lets just gather the data we need to pass to `replace_sidedata_info`. Differential Revision: https://phab.mercurial-scm.org/D10642 diff -r 78230d036e5d -r de63be070e02 mercurial/revlog.py --- a/mercurial/revlog.py Tue May 04 00:02:48 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 23:45:05 2021 +0200 @@ -3240,13 +3240,16 @@ # Apply (potential) flags to add and to remove after running # the sidedata helpers new_offset_flags = entry[0] | flags[0] & ~flags[1] - entry = (new_offset_flags,) + entry[1:8] - entry += (current_offset, len(serialized_sidedata)) + entry_update = ( + current_offset, + len(serialized_sidedata), + new_offset_flags, + ) # the sidedata computation might have move the file cursors around dfh.seek(current_offset, os.SEEK_SET) dfh.write(serialized_sidedata) - new_entries.append(entry) + new_entries.append(entry_update) current_offset += len(serialized_sidedata) if self._docket is not None: self._docket.data_end = dfh.tell() @@ -3255,7 +3258,7 @@ ifh.seek(startrev * self.index.entry_size) for i, e in enumerate(new_entries): rev = startrev + i - self.index.replace_sidedata_info(rev, e[8], e[9], e[0]) + self.index.replace_sidedata_info(rev, *e) packed = self.index.entry_binary(rev) if rev == 0 and self._docket is None: header = self._format_flags | self._format_version