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

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2019, 11:34 p.m.
Message ID <d6f646dfa422d031d04a347f1593a30e@localhost.localdomain>
Download mbox | patch
Permalink /patch/43889/
State Not Applicable
Headers show

Comments

phabricator - Dec. 16, 2019, 11:34 p.m.
martinvonz updated this revision to Diff 18777.

REPOSITORY
  rHG Mercurial

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

BRANCH
  default

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
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))