Patchwork D8074: config: also respect HGRCSKIPREPO in hgwebdir_mod

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2020, 4:48 p.m.
Message ID <0add4a9eb224222657607d0233e69212@localhost.localdomain>
Download mbox | patch
Permalink /patch/44958/
State Not Applicable
Headers show

Comments

phabricator - Feb. 5, 2020, 4:48 p.m.
Closed by commit rHG890de6f991f2: config: also respect HGRCSKIPREPO in hgwebdir_mod (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8074?vs=19879&id=19912

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8074/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8074

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py
  tests/test-hgrc.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

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 @@ 
   $ 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
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 @@ 
     pathutil,
     profiling,
     pycompat,
+    rcutil,
     registrar,
     scmutil,
     templater,
@@ -192,11 +193,12 @@ 
             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)