Commit c1ae89ec authored by smut@google.com's avatar smut@google.com

Add --changes flag to buildbucket.py's put subcommand

This flag allows the user to specify a file which contains a JSON list of dicts to set for the "changes" property when scheduling the build.

BUG=493885

Review URL: https://codereview.chromium.org/1199963004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295788 0039d316-1c4b-4281-b951-d872f2087c98
parent 1c28dab9
......@@ -51,6 +51,11 @@ def main(argv):
),
required=True,
)
put_parser.add_argument(
'-c',
'--changes',
help='A flie to load a JSON list of changes dicts from.',
)
put_parser.add_argument(
'-n',
'--builder-name',
......@@ -66,6 +71,15 @@ def main(argv):
# TODO(smut): When more commands are implemented, refactor this.
assert args.command == 'put'
changes = []
if args.changes:
try:
with open(args.changes) as fp:
changes.extend(json.load(fp))
except (TypeError, ValueError):
sys.stderr.write('%s contained invalid JSON list.\n' % args.changes)
raise
properties = {}
if args.properties:
try:
......@@ -88,6 +102,7 @@ def main(argv):
'bucket': args.bucket,
'parameters_json': json.dumps({
'builder_name': args.builder_name,
'changes': changes,
'properties': properties,
}),
}),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment