Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: apply_issue.py

Issue 60613005: Add got_revision support for apply_issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix up docstring. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « annotated_gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « annotated_gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698