The feature is now in a descent shape and we can consider having it "less"
experimental.
We won't be able to make it "totally" non-experimental, because its benefit
rely on rust, which is totally experimental.
( )
Alphare |
hg-reviewers |
The feature is now in a descent shape and we can consider having it "less"
experimental.
We won't be able to make it "totally" non-experimental, because its benefit
rely on rust, which is totally experimental.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changelog.py (4 lines) | |||
M | mercurial/localrepo.py (6 lines) | |||
M | mercurial/manifest.py (4 lines) | |||
M | mercurial/revlogutils/nodemap.py (6 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute |
datafile = b'00changelog.d' | datafile = b'00changelog.d' | ||||
revlog.revlog.__init__( | revlog.revlog.__init__( | ||||
self, | self, | ||||
opener, | opener, | ||||
indexfile, | indexfile, | ||||
datafile=datafile, | datafile=datafile, | ||||
checkambig=True, | checkambig=True, | ||||
mmaplargeindex=True, | mmaplargeindex=True, | ||||
persistentnodemap=opener.options.get( | persistentnodemap=opener.options.get(b'persistent-nodemap', False), | ||||
b'exp-persistent-nodemap', False | |||||
), | |||||
) | ) | ||||
if self._initempty and (self.version & 0xFFFF == revlog.REVLOGV1): | if self._initempty and (self.version & 0xFFFF == revlog.REVLOGV1): | ||||
# changelogs don't benefit from generaldelta. | # changelogs don't benefit from generaldelta. | ||||
self.version &= ~revlog.FLAG_GENERALDELTA | self.version &= ~revlog.FLAG_GENERALDELTA | ||||
self._generaldelta = False | self._generaldelta = False | ||||
raise error.Abort(msg % options[b'zstd.level']) | raise error.Abort(msg % options[b'zstd.level']) | ||||
if repository.NARROW_REQUIREMENT in requirements: | if repository.NARROW_REQUIREMENT in requirements: | ||||
options[b'enableellipsis'] = True | options[b'enableellipsis'] = True | ||||
if ui.configbool(b'experimental', b'rust.index'): | if ui.configbool(b'experimental', b'rust.index'): | ||||
options[b'rust.index'] = True | options[b'rust.index'] = True | ||||
if NODEMAP_REQUIREMENT in requirements: | if NODEMAP_REQUIREMENT in requirements: | ||||
options[b'exp-persistent-nodemap'] = True | options[b'persistent-nodemap'] = True | ||||
if ui.configbool(b'experimental', b'exp-persistent-nodemap.mmap'): | if ui.configbool(b'experimental', b'exp-persistent-nodemap.mmap'): | ||||
options[b'exp-persistent-nodemap.mmap'] = True | options[b'persistent-nodemap.mmap'] = True | ||||
epnm = ui.config(b'experimental', b'exp-persistent-nodemap.mode') | epnm = ui.config(b'experimental', b'exp-persistent-nodemap.mode') | ||||
options[b'exp-persistent-nodemap.mode'] = epnm | options[b'persistent-nodemap.mode'] = epnm | ||||
if ui.configbool(b'devel', b'persistent-nodemap'): | if ui.configbool(b'devel', b'persistent-nodemap'): | ||||
options[b'devel-force-nodemap'] = True | options[b'devel-force-nodemap'] = True | ||||
return options | return options | ||||
def makemain(**kwargs): | def makemain(**kwargs): | ||||
"""Produce a type conforming to ``ilocalrepositorymain``.""" | """Produce a type conforming to ``ilocalrepositorymain``.""" |
self._revlog = revlog.revlog( | self._revlog = revlog.revlog( | ||||
opener, | opener, | ||||
indexfile, | indexfile, | ||||
# only root indexfile is cached | # only root indexfile is cached | ||||
checkambig=not bool(tree), | checkambig=not bool(tree), | ||||
mmaplargeindex=True, | mmaplargeindex=True, | ||||
upperboundcomp=MAXCOMPRESSION, | upperboundcomp=MAXCOMPRESSION, | ||||
persistentnodemap=opener.options.get( | persistentnodemap=opener.options.get(b'persistent-nodemap', False), | ||||
b'exp-persistent-nodemap', False | |||||
), | |||||
) | ) | ||||
self.index = self._revlog.index | self.index = self._revlog.index | ||||
self.version = self._revlog.version | self.version = self._revlog.version | ||||
self._generaldelta = self._revlog._generaldelta | self._generaldelta = self._revlog._generaldelta | ||||
def _setupmanifestcachehooks(self, repo): | def _setupmanifestcachehooks(self, repo): | ||||
"""Persist the manifestfulltextcache on lock release""" | """Persist the manifestfulltextcache on lock release""" |
docket = NodeMapDocket(pdata[offset : offset + uid_size]) | docket = NodeMapDocket(pdata[offset : offset + uid_size]) | ||||
offset += uid_size | offset += uid_size | ||||
docket.tip_rev = tip_rev | docket.tip_rev = tip_rev | ||||
docket.tip_node = pdata[offset : offset + tip_node_size] | docket.tip_node = pdata[offset : offset + tip_node_size] | ||||
docket.data_length = data_length | docket.data_length = data_length | ||||
docket.data_unused = data_unused | docket.data_unused = data_unused | ||||
filename = _rawdata_filepath(revlog, docket) | filename = _rawdata_filepath(revlog, docket) | ||||
use_mmap = revlog.opener.options.get(b"exp-persistent-nodemap.mmap") | use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap") | ||||
try: | try: | ||||
with revlog.opener(filename) as fd: | with revlog.opener(filename) as fd: | ||||
if use_mmap: | if use_mmap: | ||||
data = util.buffer(util.mmapread(fd, data_length)) | data = util.buffer(util.mmapread(fd, data_length)) | ||||
else: | else: | ||||
data = fd.read(data_length) | data = fd.read(data_length) | ||||
except OSError as e: | except OSError as e: | ||||
if e.errno != errno.ENOENT: | if e.errno != errno.ENOENT: | ||||
) | ) | ||||
if revlog.nodemap_file is None: | if revlog.nodemap_file is None: | ||||
msg = "calling persist nodemap on a revlog without the feature enableb" | msg = "calling persist nodemap on a revlog without the feature enableb" | ||||
raise error.ProgrammingError(msg) | raise error.ProgrammingError(msg) | ||||
can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental") | can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental") | ||||
ondisk_docket = revlog._nodemap_docket | ondisk_docket = revlog._nodemap_docket | ||||
feed_data = util.safehasattr(revlog.index, "update_nodemap_data") | feed_data = util.safehasattr(revlog.index, "update_nodemap_data") | ||||
use_mmap = revlog.opener.options.get(b"exp-persistent-nodemap.mmap") | use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap") | ||||
mode = revlog.opener.options.get(b"exp-persistent-nodemap.mode") | mode = revlog.opener.options.get(b"persistent-nodemap.mode") | ||||
if not can_incremental: | if not can_incremental: | ||||
msg = _(b"persistent nodemap in strict mode without efficient method") | msg = _(b"persistent nodemap in strict mode without efficient method") | ||||
if mode == b'warn': | if mode == b'warn': | ||||
tr._report(b"%s\n" % msg) | tr._report(b"%s\n" % msg) | ||||
elif mode == b'strict': | elif mode == b'strict': | ||||
raise error.Abort(msg) | raise error.Abort(msg) | ||||
data = None | data = None |