Patchwork D8073: config: also respect HGRCSKIPREPO in `dispatch._getlocal`

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

Comments

phabricator - Feb. 5, 2020, 4:48 p.m.
Closed by commit rHG9514f2fc64ca: config: also respect HGRCSKIPREPO in `dispatch._getlocal` (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/D8073?vs=19878&id=19911

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

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

AFFECTED FILES
  mercurial/dispatch.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
@@ -271,3 +271,13 @@ 
   $ HGRCSKIPREPO=1 hg path
   foo = $TESTTMP/bar
 
+  $ cat >> .hg/hgrc <<EOF
+  > [broken
+  > EOF
+
+  $ hg path
+  hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
+  [255]
+  $ HGRCSKIPREPO=1 hg path
+  foo = $TESTTMP/bar
+
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -37,6 +37,7 @@ 
     hook,
     profiling,
     pycompat,
+    rcutil,
     registrar,
     scmutil,
     ui as uimod,
@@ -902,17 +903,20 @@ 
                 _(b"error getting current working directory: %s")
                 % encoding.strtolocal(e.strerror)
             )
+
     path = cmdutil.findrepo(wd) or b""
     if not path:
         lui = ui
     else:
         lui = ui.copy()
-        lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path)
+        if rcutil.use_repo_hgrc():
+            lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path)
 
     if rpath:
         path = lui.expandpath(rpath)
         lui = ui.copy()
-        lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path)
+        if rcutil.use_repo_hgrc():
+            lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path)
 
     return path, lui