Patchwork D7625: config: catch intended exception when failing to parse config

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2019, 12:56 p.m.
Message ID <454777826f02bb30df4bf1d4fc3f0439@localhost.localdomain>
Download mbox | patch
Permalink /patch/43916/
State Not Applicable
Headers show

Comments

phabricator - Dec. 17, 2019, 12:56 p.m.
Closed by commit rHGdbaf9aabfb69: config: catch intended exception when failing to parse config (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7625?vs=18777&id=18804

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

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

AFFECTED FILES
  mercurial/ui.py
  tests/test-trusted.py.out

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-trusted.py.out b/tests/test-trusted.py.out
--- a/tests/test-trusted.py.out
+++ b/tests/test-trusted.py.out
@@ -174,7 +174,7 @@ 
 # parse error
 # different user, different group
 not trusting file .hg/hgrc from untrusted user abc, group def
-ParseError('foo', '.hg/hgrc:1')
+ignored: ('foo', '.hg/hgrc:1')
 # same user, same group
 ParseError('foo', '.hg/hgrc:1')
 
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -440,7 +440,7 @@ 
         try:
             cfg.read(filename, fp, sections=sections, remap=remap)
             fp.close()
-        except error.ConfigError as inst:
+        except error.ParseError as inst:
             if trusted:
                 raise
             self.warn(_(b"ignored: %s\n") % stringutil.forcebytestr(inst))