changeset 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 06f1b9943b7e
children 1f0e78f8f55f
files doc/check-seclevel.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/check-seclevel.py	Sun Sep 27 22:16:24 2015 +0900
+++ b/doc/check-seclevel.py	Sun Sep 27 22:19:54 2015 +0900
@@ -126,7 +126,7 @@
             (filename, initlevel))
     return checkseclevel(doc, 'input from %s' % filename, initlevel)
 
-if __name__ == "__main__":
+def main():
     optparser = optparse.OptionParser("""%prog [options]
 
 This checks all help documents of Mercurial (topics, commands,
@@ -159,6 +159,7 @@
 
     (options, args) = optparser.parse_args()
 
+    global _verbose
     _verbose = options.verbose
 
     if options.file:
@@ -167,3 +168,6 @@
     else:
         if checkhghelps():
             sys.exit(1)
+
+if __name__ == "__main__":
+    main()