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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Dec 17 07:56:22 EST 2019


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

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



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


More information about the Mercurial-devel mailing list