Index: apply_issue.py |
diff --git a/apply_issue.py b/apply_issue.py |
index 5a8f7b6eaf2f674f2f229a578f6cf2df9ff3cb8a..c8cbfec32c55d6db9f3143dcc1ed8228d85c0df6 100755 |
--- a/apply_issue.py |
+++ b/apply_issue.py |
@@ -7,6 +7,7 @@ |
""" |
import getpass |
+import json |
import logging |
import optparse |
import os |
@@ -16,6 +17,7 @@ import urllib2 |
import breakpad # pylint: disable=W0611 |
+import annotated_gclient |
import checkout |
import fix_encoding |
import gclient_utils |
@@ -67,6 +69,9 @@ def main(): |
help='Rietveld server') |
parser.add_option('--no-auth', action='store_true', |
help='Do not attempt authenticated requests.') |
+ parser.add_option('--revision-mapping', default='{}', |
+ help='When running gclient, annotate the got_revisions ' |
+ 'using the revision-mapping.') |
options, args = parser.parse_args() |
logging.basicConfig( |
format='%(levelname)5s %(module)11s(%(lineno)4d): %(message)s', |
@@ -80,6 +85,8 @@ def main(): |
if not options.server: |
parser.error('Require a valid server') |
+ options.revision_mapping = json.loads(options.revision_mapping) |
+ |
if options.password == '-': |
print('Reading password') |
options.password = sys.stdin.readline().strip() |
@@ -178,14 +185,24 @@ def main(): |
gclient_path = os.path.join(BASE_DIR, 'gclient') |
if sys.platform == 'win32': |
gclient_path += '.bat' |
- return subprocess.call( |
- [ |
+ with annotated_gclient.temp_filename(suffix='gclient') as f: |
+ cmd = [ |
gclient_path, 'sync', |
'--revision', base_rev, |
'--nohooks', |
'--delete_unversioned_trees', |
- ], |
- cwd=gclient_root) |
+ ] |
+ if options.revision_mapping: |
+ cmd.extend(['--output-json', f]) |
+ |
+ retcode = subprocess.call(cmd, cwd=gclient_root) |
+ |
+ if retcode == 0 and options.revision_mapping: |
+ revisions = annotated_gclient.parse_got_revision( |
+ f, options.revision_mapping) |
+ annotated_gclient.emit_buildprops(revisions) |
+ |
+ return retcode |
return 0 |