[PATCH 1 of 2] check-code: use "-" to specify a list of files from stdin

Jun Wu quark at fb.com
Fri Apr 7 05:13:01 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# 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


More information about the Mercurial-devel mailing list