##// END OF EJS Templates
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard -
r4517:5371a213 default
parent child Browse files
Show More
@@ -170,7 +170,15 class ui(object):
170
170
171 cdata = util.configparser()
171 cdata = util.configparser()
172 try:
172 try:
173 cdata.read(filename)
173 try:
174 fp = open(filename)
175 except IOError, inst:
176 raise util.Abort(_("unable to open %s: %s") % (filename,
177 getattr(inst, "strerror", inst)))
178 try:
179 cdata.readfp(fp, filename)
180 finally:
181 fp.close()
174 except ConfigParser.ParsingError, inst:
182 except ConfigParser.ParsingError, inst:
175 raise util.Abort(_("failed to parse %s\n%s") % (filename,
183 raise util.Abort(_("failed to parse %s\n%s") % (filename,
176 inst))
184 inst))
@@ -470,12 +470,11 adding foo/file.txt revisions
470 adding quux/file.py revisions
470 adding quux/file.py revisions
471 added 3 changesets with 3 changes to 3 files
471 added 3 changesets with 3 changes to 3 files
472 calling hook pretxnchangegroup.acl: hgext.acl.hook
472 calling hook pretxnchangegroup.acl: hgext.acl.hook
473 acl: acl.allow enabled, 1 entries for user barney
473 error: pretxnchangegroup.acl hook failed: unable to open ../acl.config: No such file or directory
474 acl: acl.deny enabled, 0 entries for user barney
474 abort: unable to open ../acl.config: No such file or directory
475 acl: allowing changeset ef1ea85a6374
475 transaction abort!
476 acl: allowing changeset f9cafe1212c8
476 rollback completed
477 acl: allowing changeset 911600dab2ae
477 no rollback information available
478 rolling back last transaction
479 0:6675d58eff77
478 0:6675d58eff77
480
479
481 betty is allowed inside foo/ by a acl.config file
480 betty is allowed inside foo/ by a acl.config file
@@ -48,6 +48,12 template = Subject: {desc|firstline|stri
48 baseurl = http://test/
48 baseurl = http://test/
49 EOF
49 EOF
50
50
51 echo % fail for config file is missing
52 hg --cwd b rollback
53 hg --cwd b pull ../a 2>&1 | grep 'unable to open.*\.notify\.conf' > /dev/null && echo pull failed
54
55 touch "$HGTMP/.notify.conf"
56
51 echo % pull
57 echo % pull
52 hg --cwd b rollback
58 hg --cwd b rollback
53 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
59 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
@@ -34,6 +34,9 diff -r cb9a9f314b8b -r 0647d048b600 a
34 a
34 a
35 +a
35 +a
36 (run 'hg update' to get a working copy)
36 (run 'hg update' to get a working copy)
37 % fail for config file is missing
38 rolling back last transaction
39 pull failed
37 % pull
40 % pull
38 rolling back last transaction
41 rolling back last transaction
39 pulling from ../a
42 pulling from ../a
General Comments 0
You need to be logged in to leave comments. Login now