# HG changeset patch # User Soh Tk-r28629 # Date 1130781474 28800 # Node ID a4ba63e0413467096043e7691e34a4f1e05bf318 # Parent 4d38b85e60aa03be29c0e3ba30349fd405c80470 Fix traceback on bad system hgrc files diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2449,7 +2449,12 @@ def dispatch(args): except AttributeError: pass - u = ui.ui() + try: + u = ui.ui() + except util.Abort, inst: + sys.stderr.write(_("abort: %s\n") % inst) + sys.exit(1) + external = [] for x in u.extensions(): def on_exception(Exception, inst): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -32,10 +32,13 @@ class ui: self.interactive = (self.interactive and interactive) def readconfig(self, fn): - try: - self.cdata.read(fn) - except ConfigParser.ParsingError, inst: - raise util.Abort(_("Failed to parse %s\n%s") % (fn, inst)) + if isinstance(fn, basestring): + fn = [fn] + for f in fn: + try: + self.cdata.read(f) + except ConfigParser.ParsingError, inst: + raise util.Abort(_("Failed to parse %s\n%s") % (f, inst)) def setconfig(self, section, name, val): self.overlay[(section, name)] = val