Mercurial > hg
changeset 27313:9d155accd8f1
check-config: handle multiline config
author | timeless <timeless@mozdev.org> |
---|---|
date | Tue, 08 Dec 2015 08:21:46 +0000 |
parents | f925d492113a |
children | a434f15dc0f4 |
files | contrib/check-config.py |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-config.py Tue Dec 08 08:36:00 2015 +0000 +++ b/contrib/check-config.py Tue Dec 08 08:21:46 2015 +0000 @@ -13,14 +13,16 @@ foundopts = {} documented = {} -configre = (r"""ui\.config(|int|bool|list)\(['"](\S+)['"], ?""" - r"""['"](\S+)['"](,\s(?:default=)?(\S+?))?\)""") +configre = (r"""ui\.config(|int|bool|list)\(['"](\S+)['"],\s*""" + r"""['"](\S+)['"](,\s+(?:default=)?(\S+?))?\)""") +configpartialre = (r"""ui\.config""") def main(args): for f in args: sect = '' prevname = '' confsect = '' + carryover = '' for l in open(f): # check topic-like bits @@ -67,7 +69,8 @@ documented[m.group(1)] = 1 # look for code-like bits - m = re.search(configre, l) + line = carryover + l + m = re.search(configre, line, re.MULTILINE) if m: ctype = m.group(1) if not ctype: @@ -83,6 +86,13 @@ print "conflict on %s: %r != %r" % (name, (ctype, default), foundopts[name]) foundopts[name] = (ctype, default) + carryover = '' + else: + m = re.search(configpartialre, line) + if m: + carryover = line + else: + carryover = '' for name in sorted(foundopts): if name not in documented: