# HG changeset patch # User Pierre-Yves David # Date 2020-02-04 11:07:42 # Node ID bf23d6ee7ec784f8ef018465ddc5d2fd97632d8c # Parent ef11dfc5667459b5b04f70a21de3fa7965889d9d config: also respect HGRCSKIPREPO in hgwebdir_mod Differential Revision: https://phab.mercurial-scm.org/D8074 diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -35,6 +35,7 @@ from .. import ( pathutil, profiling, pycompat, + rcutil, registrar, scmutil, templater, @@ -192,11 +193,12 @@ def rawindexentries(ui, repos, req, subd continue u = ui.copy() - try: - u.readconfig(os.path.join(path, b'.hg', b'hgrc')) - except Exception as e: - u.warn(_(b'error reading %s/.hg/hgrc: %s\n') % (path, e)) - continue + if rcutil.use_repo_hgrc(): + try: + u.readconfig(os.path.join(path, b'.hg', b'hgrc')) + except Exception as e: + u.warn(_(b'error reading %s/.hg/hgrc: %s\n') % (path, e)) + continue def get(section, name, default=uimod._unset): return u.config(section, name, default, untrusted=True) diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t --- a/tests/test-hgrc.t +++ b/tests/test-hgrc.t @@ -281,3 +281,21 @@ Test we can skip the user configuration $ HGRCSKIPREPO=1 hg path foo = $TESTTMP/bar +Check that hgweb respect HGRCSKIPREPO=1 + + $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log + hg: parse error at $TESTTMP/.hg/hgrc:3: [broken + [255] + $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS) + [1] + $ killdaemons.py + $ test -f access.log && cat access.log + [1] + $ test -f errors.log && cat errors.log + [1] + + $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log + $ cat hg.pid >> $DAEMON_PIDS + $ killdaemons.py + $ cat access.log + $ cat errors.log