Chromium Code Reviews| Index: commit_queue.py |
| diff --git a/commit_queue.py b/commit_queue.py |
| index b08d4fec7ccff426c3d4dd241ff5ed6273e5b16d..0822d3763fc41eed9f8e5336c00233c6407f5aa3 100755 |
| --- a/commit_queue.py |
| +++ b/commit_queue.py |
| @@ -26,6 +26,7 @@ THIRD_PARTY_DIR = os.path.join(os.path.dirname(__file__), 'third_party') |
| sys.path.insert(0, THIRD_PARTY_DIR) |
| from cq_client import cq_pb2 |
| +from cq_client import validate_config |
| from protobuf26 import text_format |
| def usage(more): |
| @@ -143,6 +144,25 @@ def CMDbuilders(parser, args): |
| CMDbuilders.func_usage_more = '<path-to-cq-config>' |
| + |
| +def CMDvalidate(parser, args): |
| + """Validates a CQ config. |
| + |
| + Takes a single argument - path to the CQ config to be validated. Returns 0 on |
| + valid config, non-zero on invalid config. Errors and warnings are printed to |
| + screen. |
| + """ |
| + _, args = parser.parse_args(args) |
| + if len(args) != 1: |
| + parser.error('Expected a single path to CQ config. Got: %s' % |
| + ' '.join(args)) |
| + |
| + with open(args[0]) as config_file: |
| + cq_config = config_file.read() |
| + return 0 if validate_config.IsValid(cq_config) else 1 |
|
pgervais
2015/06/24 01:10:43
Nit: this should live outside the with statement
Sergiy Byelozyorov
2015/06/24 05:30:59
Done.
|
| + |
| +CMDvalidate.func_usage_more = '<path-to-cq-config>' |
| + |
| ############################################################################### |
| ## Boilerplate code |