changeset 1483:a4ba63e04134

Fix traceback on bad system hgrc files
author Soh Tk-r28629 <tksoh@freescale.com>
date Mon, 31 Oct 2005 09:57:54 -0800
parents 4d38b85e60aa
children 840808c57969
files mercurial/commands.py mercurial/ui.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 31 10:56:42 2005 -0700
+++ b/mercurial/commands.py	Mon Oct 31 09:57:54 2005 -0800
@@ -2449,7 +2449,12 @@
     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):
--- a/mercurial/ui.py	Mon Oct 31 10:56:42 2005 -0700
+++ b/mercurial/ui.py	Mon Oct 31 09:57:54 2005 -0800
@@ -32,10 +32,13 @@
         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