# HG changeset patch # User Pierre-Yves David # Date 2020-02-04 11:31:19 # Node ID 238790674d699a5db3a6b07e83f0e677d95ab029 # Parent 847e582f3cc962dccedb2d163a14e9c625bf1bc0 config: add a function in `rcutil` to abstract HGRCSKIPREPO We wil need to respect this environment variable in more place. Differential Revision: https://phab.mercurial-scm.org/D8072 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -53,6 +53,7 @@ from . import ( phases, pushkey, pycompat, + rcutil, repoview, revset, revsetlang, @@ -676,7 +677,7 @@ def loadhgrc(ui, wdirvfs, hgvfs, require configs are loaded. For example, an extension may wish to pull in configs from alternate files or sources. """ - if b'HGRCSKIPREPO' in encoding.environ: + if not rcutil.use_repo_hgrc(): return False try: ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py --- a/mercurial/rcutil.py +++ b/mercurial/rcutil.py @@ -112,3 +112,8 @@ def defaultpagerenv(): intended to be set before starting a pager. ''' return {b'LESS': b'FRX', b'LV': b'-c'} + + +def use_repo_hgrc(): + """True if repositories `.hg/hgrc` config should be read""" + return b'HGRCSKIPREPO' not in encoding.environ