[PATCH] ui: make readsections() abort when configuration cannot be read

Patrick Mezard pmezard at gmail.com
Sun Jun 3 11:19:36 CDT 2007


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1180887381 -7200
# Node ID fdd57d2516715df4ab5d83a9a0b70d4dd0339b70
# Parent  41fb67578b36137e4025b011e9ae8814509fbf37
ui: make readsections() abort when configuration cannot be read.

diff -r 41fb67578b36 -r fdd57d251671 mercurial/ui.py
--- a/mercurial/ui.py	Thu May 24 16:32:38 2007 +0200
+++ b/mercurial/ui.py	Sun Jun 03 18:16:21 2007 +0200
@@ -170,7 +170,9 @@ class ui(object):
 
         cdata = util.configparser()
         try:
-            cdata.read(filename)
+            read = cdata.read(filename)
+            if not read:
+                raise util.Abort(_("failed to open %s") % filename)
         except ConfigParser.ParsingError, inst:
             raise util.Abort(_("failed to parse %s\n%s") % (filename,
                                                             inst))
diff -r 41fb67578b36 -r fdd57d251671 tests/test-notify
--- a/tests/test-notify	Thu May 24 16:32:38 2007 +0200
+++ b/tests/test-notify	Sun Jun 03 18:16:21 2007 +0200
@@ -48,6 +48,8 @@ baseurl = http://test/
 baseurl = http://test/
 EOF
 
+touch $HGTMP/.notify.conf
+
 echo % pull
 hg --cwd b rollback
 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \


More information about the Mercurial-devel mailing list