comparison mercurial/unionrepo.py @ 47072:4c041c71ec01

revlog: introduce an explicit tracking of what the revlog is about Since the dawn of time, people have been forced to rely to lossy introspection of the index filename to determine what the purpose and role of the revlog they encounter is. This is hacky, error prone, inflexible, abstraction-leaky, <insert-your-own-complaints-here>. In f63299ee7e4d Rapha?l introduced a new attribute to track this information: `revlog_kind`. However it is initialized in an odd place and various instances end up not having it set. In addition is only tracking some of the information we end up having to introspect in various pieces of code. So we add a new attribute that holds more data and is more strictly enforced. This work is done in collaboration with Rapha?l. The `revlog_kind` one will be removed/adapted in the next changeset. We expect to be able to clean up various existing piece of code and to simplify coming work around the newer revlog format. Differential Revision: https://phab.mercurial-scm.org/D10352
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 06 Apr 2021 05:20:24 +0200
parents 6266d19556ad
children 4292bed8da7c
comparison
equal deleted inserted replaced
47071:3e381eb557f3 47072:4c041c71ec01
39 # look it up in revlog2. 39 # look it up in revlog2.
40 # 40 #
41 # To differentiate a rev in the second revlog from a rev in the revlog, 41 # To differentiate a rev in the second revlog from a rev in the revlog,
42 # we check revision against repotiprev. 42 # we check revision against repotiprev.
43 opener = vfsmod.readonlyvfs(opener) 43 opener = vfsmod.readonlyvfs(opener)
44 revlog.revlog.__init__(self, opener, indexfile) 44 target = getattr(revlog2, 'target', None)
45 if target is None:
46 # a revlog wrapper, eg: the manifestlog that is not an actual revlog
47 target = revlog2._revlog.target
48 revlog.revlog.__init__(self, opener, target=target, indexfile=indexfile)
45 self.revlog2 = revlog2 49 self.revlog2 = revlog2
46 50
47 n = len(self) 51 n = len(self)
48 self.repotiprev = n - 1 52 self.repotiprev = n - 1
49 self.bundlerevs = set() # used by 'bundle()' revset expression 53 self.bundlerevs = set() # used by 'bundle()' revset expression