Mercurial > hg-stable
view tests/test-config-env.py @ 51250:1b23aaf5eb7b
rust-index: optimize find_gca_candidates() on less than 8 revisions
This is expected to be by far the most common case, given that, e.g.,
merging involves using it on two revisions.
Using a `u8` as support for the bitset obviously divides the amount of
RAM needed by 8. To state the obvious, on a repository with 10 million
changesets, this spares 70MB. It is also possible that it'd be slightly
faster, because it is easier to allocate and provides better cache locality.
It is possible that some exhaustive listing of the traits implemented by
`u8` and `u64` would avoid the added duplication, but that can be done later
and would need a replacement for the `MAX` consts.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Fri, 20 Oct 2023 09:12:22 +0200 |
parents | 6000f5b25c9b |
children | 493034cc3265 |
line wrap: on
line source
# Test the config layer generated by environment variables import os from mercurial import ( encoding, extensions, rcutil, ui as uimod, util, ) from mercurial.utils import procutil testtmp = encoding.environ[b'TESTTMP'] # prepare hgrc files def join(name): return os.path.join(testtmp, name) with open(join(b'sysrc'), 'wb') as f: f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n') with open(join(b'userrc'), 'wb') as f: f.write(b'[ui]\neditor=e1') # replace rcpath functions so they point to the files above def systemrcpath(): return [join(b'sysrc')] def userrcpath(): return [join(b'userrc')] extensions.wrapfunction(rcutil, 'default_rc_resources', lambda orig: []) rcutil.systemrcpath = systemrcpath rcutil.userrcpath = userrcpath # utility to print configs def printconfigs(env): encoding.environ = env rcutil._rccomponents = None # reset cache ui = uimod.ui.load() for section, name, value in ui.walkconfig(): source = ui.configsource(section, name) procutil.stdout.write( b'%s.%s=%s # %s\n' % (section, name, value, util.pconvert(source)) ) procutil.stdout.write(b'\n') # environment variable overrides printconfigs({}) printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})