comparison mercurial/revlogutils/nodemap.py @ 48693:de3ac3d2c60b

stream-clone: allow to change persistent-nodemap format during stream clone Persistent nodemap affect the store format. However it is fairly isolated and fast to generate locally. So not making it a fixed part of the stream clone is useful. This allow clients without persistent-nodemap support (default for client without Rust enabled, or simply older client). So it make it possible to enable persistent nodemap on client, where it can provide a massive boost. without too much consequence. To do so, we stop using it in the advertisement requirements for streaming and let the client add/remove the necessary file depending of its configuration. We still send the files as it seems like a small save to not regenerate them. In addition, the way we match them will overlap with the changelog-v2/revlog-v2 so we can't simply skip the associated patterns. Differential Revision: https://phab.mercurial-scm.org/D12096
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 27 Jan 2022 22:24:11 +0100
parents d55c4472bbb6
children 6000f5b25c9b
comparison
equal deleted inserted replaced
48692:4933086bebf5 48693:de3ac3d2c60b
14 14
15 from ..node import hex 15 from ..node import hex
16 16
17 from .. import ( 17 from .. import (
18 error, 18 error,
19 requirements,
19 util, 20 util,
20 ) 21 )
21 from . import docket as docket_mod 22 from . import docket as docket_mod
22 23
23 24
30 """hook point for test 31 """hook point for test
31 32
32 This let tests to have things happens between the docket reading and the 33 This let tests to have things happens between the docket reading and the
33 data reading""" 34 data reading"""
34 pass 35 pass
36
37
38 def post_stream_cleanup(repo):
39 """The stream clone might needs to remove some file if persisten nodemap
40 was dropped while stream cloning
41 """
42 if requirements.REVLOGV1_REQUIREMENT not in repo.requirements:
43 return
44 if requirements.NODEMAP_REQUIREMENT in repo.requirements:
45 return
46 unfi = repo.unfiltered()
47 delete_nodemap(None, unfi, unfi.changelog)
48 delete_nodemap(None, repo, unfi.manifestlog._rootstore._revlog)
35 49
36 50
37 def persisted_data(revlog): 51 def persisted_data(revlog):
38 """read the nodemap for a revlog from disk""" 52 """read the nodemap for a revlog from disk"""
39 if revlog._nodemap_file is None: 53 if revlog._nodemap_file is None: