Mercurial > hg
view tests/test-config-env.py @ 39802:3bc4fce0167f stable
revset: remove part of the commonancestors() comment
The reason is that:
- it shows up in "hg help revset", but it doesn't look like
documentation targeted at users
- it doesn't make sense to me: it doesn't say what happens with < 2
revisions, and is not quite right because my understanding is that
this revset was created precisely because "::x and ::y" was not
quite the same (when x and y don't evaluate to singletons).
Differential Revision: https://phab.mercurial-scm.org/D4739
author | Valentin Gatien-Baron <vgatien-baron@janestreet.com> |
---|---|
date | Tue, 25 Sep 2018 16:14:57 -0400 |
parents | d4a2e0d5d042 |
children | 2372284d9457 |
line wrap: on
line source
# Test the config layer generated by environment variables from __future__ import absolute_import, print_function import os from mercurial import ( encoding, 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')] rcutil.systemrcpath = systemrcpath rcutil.userrcpath = userrcpath os.path.isdir = lambda x: False # hack: do not load default.d/*.rc # 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'})