Mercurial > hg
comparison contrib/check-config.py @ 28352:a92ee4d8a574
check-config: use absolute_import and print_function
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 06 Mar 2016 03:01:46 +0530 |
parents | 8f244b75cc5e |
children | e5a6a540ae63 |
comparison
equal
deleted
inserted
replaced
28351:42a7301fb4d5 | 28352:a92ee4d8a574 |
---|---|
5 # Copyright 2015 Matt Mackall <mpm@selenic.com> | 5 # Copyright 2015 Matt Mackall <mpm@selenic.com> |
6 # | 6 # |
7 # This software may be used and distributed according to the terms of the | 7 # This software may be used and distributed according to the terms of the |
8 # GNU General Public License version 2 or any later version. | 8 # GNU General Public License version 2 or any later version. |
9 | 9 |
10 from __future__ import absolute_import, print_function | |
10 import re | 11 import re |
11 import sys | 12 import sys |
12 | 13 |
13 foundopts = {} | 14 foundopts = {} |
14 documented = {} | 15 documented = {} |
80 if default in (None, 'False', 'None', '0', '[]', '""', "''"): | 81 if default in (None, 'False', 'None', '0', '[]', '""', "''"): |
81 default = '' | 82 default = '' |
82 if re.match('[a-z.]+$', default): | 83 if re.match('[a-z.]+$', default): |
83 default = '<variable>' | 84 default = '<variable>' |
84 if name in foundopts and (ctype, default) != foundopts[name]: | 85 if name in foundopts and (ctype, default) != foundopts[name]: |
85 print l | 86 print(l) |
86 print "conflict on %s: %r != %r" % (name, (ctype, default), | 87 print("conflict on %s: %r != %r" % (name, (ctype, default), |
87 foundopts[name]) | 88 foundopts[name])) |
88 foundopts[name] = (ctype, default) | 89 foundopts[name] = (ctype, default) |
89 carryover = '' | 90 carryover = '' |
90 else: | 91 else: |
91 m = re.search(configpartialre, line) | 92 m = re.search(configpartialre, line) |
92 if m: | 93 if m: |
100 name.startswith("experimental.") or | 101 name.startswith("experimental.") or |
101 name.startswith("debug.")): | 102 name.startswith("debug.")): |
102 ctype, default = foundopts[name] | 103 ctype, default = foundopts[name] |
103 if default: | 104 if default: |
104 default = ' [%s]' % default | 105 default = ' [%s]' % default |
105 print "undocumented: %s (%s)%s" % (name, ctype, default) | 106 print("undocumented: %s (%s)%s" % (name, ctype, default)) |
106 | 107 |
107 if __name__ == "__main__": | 108 if __name__ == "__main__": |
108 if len(sys.argv) > 1: | 109 if len(sys.argv) > 1: |
109 sys.exit(main(sys.argv[1:])) | 110 sys.exit(main(sys.argv[1:])) |
110 else: | 111 else: |