comparison mercurial/changelog.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 d55b71393907
children 64cd1496bb70
comparison
equal deleted inserted replaced
47071:3e381eb557f3 47072:4c041c71ec01
23 ) 23 )
24 from .utils import ( 24 from .utils import (
25 dateutil, 25 dateutil,
26 stringutil, 26 stringutil,
27 ) 27 )
28 from .revlogutils import flagutil 28 from .revlogutils import (
29 constants as revlog_constants,
30 flagutil,
31 )
29 32
30 _defaultextra = {b'branch': b'default'} 33 _defaultextra = {b'branch': b'default'}
31 34
32 35
33 def _string_escape(text): 36 def _string_escape(text):
399 402
400 datafile = b'00changelog.d' 403 datafile = b'00changelog.d'
401 revlog.revlog.__init__( 404 revlog.revlog.__init__(
402 self, 405 self,
403 opener, 406 opener,
404 indexfile, 407 target=(revlog_constants.KIND_CHANGELOG, None),
408 indexfile=indexfile,
405 datafile=datafile, 409 datafile=datafile,
406 checkambig=True, 410 checkambig=True,
407 mmaplargeindex=True, 411 mmaplargeindex=True,
408 persistentnodemap=opener.options.get(b'persistent-nodemap', False), 412 persistentnodemap=opener.options.get(b'persistent-nodemap', False),
409 concurrencychecker=concurrencychecker, 413 concurrencychecker=concurrencychecker,