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

Side by Side Diff: tools/submit_try

Issue 128413004: submit_try: create the diff file using git, rather than relying on trychange.py (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 7
8 """ 8 """
9 submit_try: Submit a try request. 9 submit_try: Submit a try request.
10 10
11 This is a thin wrapper around the try request utilities in depot_tools which 11 This is a thin wrapper around the try request utilities in depot_tools which
12 adds some validation and supports both git and svn. 12 adds some validation and supports both git and svn.
13 """ 13 """
14 14
15 15
16 import httplib 16 import httplib
17 import json 17 import json
18 import os 18 import os
19 import re 19 import re
20 import shutil
20 import subprocess 21 import subprocess
21 import svn 22 import svn
22 import sys 23 import sys
24 import tempfile
23 25
24 import buildbot_globals 26 import buildbot_globals
25 27
26 28
27 # Alias which can be used to run a try on every builder. 29 # Alias which can be used to run a try on every builder.
28 ALL_BUILDERS = 'all' 30 ALL_BUILDERS = 'all'
29 # Alias which can be used to run a try on all compile builders. 31 # Alias which can be used to run a try on all compile builders.
30 COMPILE_BUILDERS = 'compile' 32 COMPILE_BUILDERS = 'compile'
31 # Alias which can be used to run a try on all builders that are run in the CQ. 33 # Alias which can be used to run a try on all builders that are run in the CQ.
32 CQ_BUILDERS = 'cq' 34 CQ_BUILDERS = 'cq'
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if args.revision: 265 if args.revision:
264 try_args.extend(['-r', args.revision]) 266 try_args.extend(['-r', args.revision])
265 print ' '.join(try_args) 267 print ' '.join(try_args)
266 proc = subprocess.Popen(try_args, stdout=subprocess.PIPE, 268 proc = subprocess.Popen(try_args, stdout=subprocess.PIPE,
267 stderr=subprocess.STDOUT) 269 stderr=subprocess.STDOUT)
268 if proc.wait() != 0: 270 if proc.wait() != 0:
269 raise Exception('Failed to submit try request: %s' % ( 271 raise Exception('Failed to submit try request: %s' % (
270 proc.communicate()[0])) 272 proc.communicate()[0]))
271 print proc.communicate()[0] 273 print proc.communicate()[0]
272 else: 274 else:
273 # First, find depot_tools. This is needed to import trychange. 275 # Create the diff file.
274 sys.path.append(FindDepotTools()) 276 cmd = ['git.bat' if os.name == 'nt' else 'git', 'diff', 'origin/master']
275 import trychange 277 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
276 try_args = ['--use_svn', 278 if proc.wait() != 0:
277 '--svn_repo', GetTryRepo(), 279 raise Exception('Failed to capture git diff!')
278 '--root', GetCheckoutRoot(is_svn), 280
279 '--bot', botlist, 281 temp_dir = tempfile.mkdtemp()
280 '--patchlevel', '0'] 282 try:
281 if args.revision: 283 diff_file = os.path.join(temp_dir, 'patch.diff')
282 try_args.extend(['-r', args.revision]) 284 with open(diff_file, 'wb') as f:
283 trychange.TryChange(try_args, None, False) 285 f.write(proc.communicate()[0])
286
287 # Find depot_tools. This is needed to import trychange.
288 sys.path.append(FindDepotTools())
289 import trychange
290 try_args = ['--use_svn',
291 '--svn_repo', GetTryRepo(),
292 '--root', GetCheckoutRoot(is_svn),
293 '--bot', botlist,
294 '--diff', diff_file,
295 ]
296 if args.revision:
297 try_args.extend(['-r', args.revision])
298
299 # Submit the try request.
300 trychange.TryChange(try_args, None, False)
301 finally:
302 shutil.rmtree(temp_dir)
284 303
285 304
286 def main(): 305 def main():
287 # Retrieve the list of active try builders from the build master. 306 # Retrieve the list of active try builders from the build master.
288 trybots = RetrieveTrybotList(json_filename='trybots') 307 trybots = RetrieveTrybotList(json_filename='trybots')
289 308
290 # Determine if we're in an SVN checkout. 309 # Determine if we're in an SVN checkout.
291 is_svn = os.path.isdir('.svn') 310 is_svn = os.path.isdir('.svn')
292 311
293 # Parse and validate the command-line arguments. 312 # Parse and validate the command-line arguments.
294 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) 313 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn)
295 314
296 # Submit the try request. 315 # Submit the try request.
297 SubmitTryRequest(args, is_svn=is_svn) 316 SubmitTryRequest(args, is_svn=is_svn)
298 317
299 318
300 if __name__ == '__main__': 319 if __name__ == '__main__':
301 sys.exit(main()) 320 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698