Mercurial > public > mercurial-scm > hg
comparison doc/check-seclevel.py @ 26398:70abba798098
check-seclevel: wrap entry point by function
This is intended to narrow scope of local variables. The global _verbose
flag will be replaced later by ui.verbose.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 27 Sep 2015 22:19:54 +0900 |
parents | 67e6e55360d2 |
children | dd62eaa82cbe |
comparison
equal
deleted
inserted
replaced
26397:06f1b9943b7e | 26398:70abba798098 |
---|---|
124 | 124 |
125 verbose('checking input from %s with initlevel %d' % | 125 verbose('checking input from %s with initlevel %d' % |
126 (filename, initlevel)) | 126 (filename, initlevel)) |
127 return checkseclevel(doc, 'input from %s' % filename, initlevel) | 127 return checkseclevel(doc, 'input from %s' % filename, initlevel) |
128 | 128 |
129 if __name__ == "__main__": | 129 def main(): |
130 optparser = optparse.OptionParser("""%prog [options] | 130 optparser = optparse.OptionParser("""%prog [options] |
131 | 131 |
132 This checks all help documents of Mercurial (topics, commands, | 132 This checks all help documents of Mercurial (topics, commands, |
133 extensions and commands of them), if no file is specified by --file | 133 extensions and commands of them), if no file is specified by --file |
134 option. | 134 option. |
157 help="set initial section level manually", | 157 help="set initial section level manually", |
158 action="store", type="int", default=0) | 158 action="store", type="int", default=0) |
159 | 159 |
160 (options, args) = optparser.parse_args() | 160 (options, args) = optparser.parse_args() |
161 | 161 |
162 global _verbose | |
162 _verbose = options.verbose | 163 _verbose = options.verbose |
163 | 164 |
164 if options.file: | 165 if options.file: |
165 if checkfile(options.file, options.initlevel): | 166 if checkfile(options.file, options.initlevel): |
166 sys.exit(1) | 167 sys.exit(1) |
167 else: | 168 else: |
168 if checkhghelps(): | 169 if checkhghelps(): |
169 sys.exit(1) | 170 sys.exit(1) |
171 | |
172 if __name__ == "__main__": | |
173 main() |