Mercurial > public > mercurial-scm > hg
comparison contrib/check-code.py @ 31824:4804644489cf
check-code: use "-" to specify a list of files from stdin
This will be used by the next patch.
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 06 Apr 2017 22:08:23 -0700 |
parents | 2a865df042b7 |
children | 14c5a7637ecc |
comparison
equal
deleted
inserted
replaced
31823:f6d77af84ef3 | 31824:4804644489cf |
---|---|
671 break | 671 break |
672 | 672 |
673 return result | 673 return result |
674 | 674 |
675 def main(): | 675 def main(): |
676 parser = optparse.OptionParser("%prog [options] [files]") | 676 parser = optparse.OptionParser("%prog [options] [files | -]") |
677 parser.add_option("-w", "--warnings", action="store_true", | 677 parser.add_option("-w", "--warnings", action="store_true", |
678 help="include warning-level checks") | 678 help="include warning-level checks") |
679 parser.add_option("-p", "--per-file", type="int", | 679 parser.add_option("-p", "--per-file", type="int", |
680 help="max warnings per file") | 680 help="max warnings per file") |
681 parser.add_option("-b", "--blame", action="store_true", | 681 parser.add_option("-b", "--blame", action="store_true", |
689 lineno=True) | 689 lineno=True) |
690 (options, args) = parser.parse_args() | 690 (options, args) = parser.parse_args() |
691 | 691 |
692 if len(args) == 0: | 692 if len(args) == 0: |
693 check = glob.glob("*") | 693 check = glob.glob("*") |
694 elif args == ['-']: | |
695 # read file list from stdin | |
696 check = sys.stdin.read().splitlines() | |
694 else: | 697 else: |
695 check = args | 698 check = args |
696 | 699 |
697 _preparepats() | 700 _preparepats() |
698 | 701 |