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

Side by Side Diff: trychange.py

Issue 74163002: Allow PRESUBMIT.py files to have old and new-style trybot specifications (as long as each file is c… (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Address maruel nits. Created 7 years 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
« no previous file with comments | « tests/presubmit_unittest.py ('k') | 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn repository or by directly connecting 7 the try server by either writting to a svn repository or by directly connecting
8 to the server by HTTP. 8 to the server by HTTP.
9 """ 9 """
10 10
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 options.email) 374 options.email)
375 trybots = presubmit_support.DoGetTrySlaves( 375 trybots = presubmit_support.DoGetTrySlaves(
376 change, 376 change,
377 checkouts[0].GetFileNames(), 377 checkouts[0].GetFileNames(),
378 checkouts[0].checkout_root, 378 checkouts[0].checkout_root,
379 root_presubmit, 379 root_presubmit,
380 options.project, 380 options.project,
381 options.verbose, 381 options.verbose,
382 sys.stdout) 382 sys.stdout)
383 if trybots: 383 if trybots:
384 if isinstance(trybots[0], basestring): 384 old_style = filter(lambda x: isinstance(x, basestring), trybots)
385 # PRESUBMIT.py sent us an old-style string list of bots. 385 new_style = filter(lambda x: isinstance(x, tuple), trybots)
386 # _ParseBotList's testfilter is set to None otherwise it will complain. 386
387 bot_spec = _ApplyTestFilter(options.testfilter, 387 # _ParseBotList's testfilter is set to None otherwise it will complain.
388 _ParseBotList(trybots, None)) 388 bot_spec = _ApplyTestFilter(options.testfilter,
389 else: 389 _ParseBotList(old_style, None))
390 # PRESUBMIT.py sent us a new-style (bot, set()) specification. 390
391 bot_spec = _ApplyTestFilter(options.testfilter, trybots) 391 bot_spec.extend(_ApplyTestFilter(options.testfilter, new_style))
392 392
393 except ImportError: 393 except ImportError:
394 pass 394 pass
395 395
396 return bot_spec 396 return bot_spec
397 397
398 398
399 def _ParseSendChangeOptions(bot_spec, options): 399 def _ParseSendChangeOptions(bot_spec, options):
400 """Parse common options passed to _SendChangeHTTP and _SendChangeSVN.""" 400 """Parse common options passed to _SendChangeHTTP and _SendChangeSVN."""
401 values = [ 401 values = [
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return 1 933 return 1
934 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 934 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
935 print >> sys.stderr, e 935 print >> sys.stderr, e
936 return 1 936 return 1
937 return 0 937 return 0
938 938
939 939
940 if __name__ == "__main__": 940 if __name__ == "__main__":
941 fix_encoding.fix_encoding() 941 fix_encoding.fix_encoding()
942 sys.exit(TryChange(None, None, False)) 942 sys.exit(TryChange(None, None, False))
OLDNEW
« no previous file with comments | « tests/presubmit_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698