# HG changeset patch # User FUJIWARA Katsunori # Date 2016-05-20 00:47:35 # Node ID 7825f6154a650ff3e2378e2481f155fcdb1129bc # Parent 7e2b389418da245f3df9c016cac135ca84818834 check-code: factor out boot procedure into main This is a part of preparation for adding check-code.py extra checks by another python script in subsequent patch. This is also useful for SkeletonExtensionPlan. https://www.mercurial-scm.org/wiki/SkeletonExtensionPlan diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -622,7 +622,7 @@ def checkfile(f, logfunc=_defaultlogger. return result -if __name__ == "__main__": +def main(): parser = optparse.OptionParser("%prog [options] [files]") parser.add_option("-w", "--warnings", action="store_true", help="include warning-level checks") @@ -650,4 +650,7 @@ if __name__ == "__main__": blame=options.blame, debug=options.debug, lineno=options.lineno): ret = 1 - sys.exit(ret) + return ret + +if __name__ == "__main__": + sys.exit(main())