Mercurial > hg
comparison mercurial/config.py @ 10042:7cdd2a7db2c2 stable
config: raise ConfigError on non-existing include files
Before, an %include directive for a non-existing file resulted in an
IOError and a traceback.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sat, 12 Dec 2009 16:46:16 +0100 |
parents | bccf780f78ed |
children | 25e572394f5c |
comparison
equal
deleted
inserted
replaced
10025:fb45c1e4396f | 10042:7cdd2a7db2c2 |
---|---|
98 if m: | 98 if m: |
99 inc = m.group(1) | 99 inc = m.group(1) |
100 base = os.path.dirname(src) | 100 base = os.path.dirname(src) |
101 inc = os.path.normpath(os.path.join(base, inc)) | 101 inc = os.path.normpath(os.path.join(base, inc)) |
102 if include: | 102 if include: |
103 include(inc, remap=remap, sections=sections) | 103 try: |
104 include(inc, remap=remap, sections=sections) | |
105 except IOError, inst: | |
106 msg = _("config error at %s:%d: " | |
107 "cannot include %s (%s)") \ | |
108 % (src, line, inc, inst.strerror) | |
109 raise error.ConfigError(msg) | |
104 continue | 110 continue |
105 if emptyre.match(l): | 111 if emptyre.match(l): |
106 continue | 112 continue |
107 m = sectionre.match(l) | 113 m = sectionre.match(l) |
108 if m: | 114 if m: |