From patchwork Fri Apr 7 05:13:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2] check-code: use "-" to specify a list of files from stdin From: Jun Wu X-Patchwork-Id: 19991 Message-Id: <9a84025f33b33ba68a7c.1491541981@x1c> To: Date: Thu, 6 Apr 2017 22:13:01 -0700 # HG changeset patch # User Jun Wu # Date 1491541703 25200 # Thu Apr 06 22:08:23 2017 -0700 # Node ID 9a84025f33b33ba68a7c0bac763f9c756e1f81d0 # Parent 45761ef1bc935b1fab74adccf2541ef854b1c2eb # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r 9a84025f33b3 check-code: use "-" to specify a list of files from stdin This will be used by the next patch. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -674,5 +674,5 @@ def checkfile(f, logfunc=_defaultlogger. def main(): - parser = optparse.OptionParser("%prog [options] [files]") + parser = optparse.OptionParser("%prog [options] [files | -]") parser.add_option("-w", "--warnings", action="store_true", help="include warning-level checks") @@ -692,4 +692,7 @@ def main(): if len(args) == 0: check = glob.glob("*") + elif args == ['-']: + # read file list from stdin + check = sys.stdin.read().splitlines() else: check = args