Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
4516:96d8a56d4ef9 | 4517:5371a213b0f4 |
---|---|
168 if not sections: | 168 if not sections: |
169 return | 169 return |
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)) |
177 | 185 |
178 for section in sections: | 186 for section in sections: |