Mercurial > public > mercurial-scm > hg-stable
diff mercurial/ui.py @ 4517:5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 03 Jun 2007 22:11:25 +0200 |
parents | 1b5b98837bb5 |
children | 669e76b7df24 |
line wrap: on
line diff
--- a/mercurial/ui.py Wed Jun 06 20:22:52 2007 +0200 +++ b/mercurial/ui.py Sun Jun 03 22:11:25 2007 +0200 @@ -170,7 +170,15 @@ cdata = util.configparser() try: - cdata.read(filename) + try: + fp = open(filename) + except IOError, inst: + raise util.Abort(_("unable to open %s: %s") % (filename, + getattr(inst, "strerror", inst))) + try: + cdata.readfp(fp, filename) + finally: + fp.close() except ConfigParser.ParsingError, inst: raise util.Abort(_("failed to parse %s\n%s") % (filename, inst))