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

Side by Side Diff: trychange.py

Issue 7925014: Support for |change| argument to |GetPreferredTrySlaves()|. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: '' Created 9 years, 3 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
« presubmit_support.py ('K') | « 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) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 def GetMungedDiff(path_diff, diff): 457 def GetMungedDiff(path_diff, diff):
458 # Munge paths to match svn. 458 # Munge paths to match svn.
459 for i in range(len(diff)): 459 for i in range(len(diff)):
460 if diff[i].startswith('--- ') or diff[i].startswith('+++ '): 460 if diff[i].startswith('--- ') or diff[i].startswith('+++ '):
461 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/') 461 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/')
462 diff[i] = diff[i][0:4] + new_file 462 diff[i] = diff[i][0:4] + new_file
463 return diff 463 return diff
464 464
465 465
466 def TryChange(argv, 466 def TryChange(argv,
467 change,
467 file_list, 468 file_list,
468 swallow_exception, 469 swallow_exception,
469 prog=None, 470 prog=None,
470 extra_epilog=None): 471 extra_epilog=None):
471 """ 472 """
472 Args: 473 Args:
473 argv: Arguments and options. 474 argv: Arguments and options.
474 file_list: Default value to pass to --file. 475 file_list: Default value to pass to --file.
475 swallow_exception: Whether we raise or swallow exceptions. 476 swallow_exception: Whether we raise or swallow exceptions.
476 """ 477 """
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 options.diff = ''.join(diffs) 703 options.diff = ''.join(diffs)
703 704
704 if not options.bot: 705 if not options.bot:
705 # Get try slaves from PRESUBMIT.py files if not specified. 706 # Get try slaves from PRESUBMIT.py files if not specified.
706 # Even if the diff comes from options.url, use the local checkout for bot 707 # Even if the diff comes from options.url, use the local checkout for bot
707 # selection. 708 # selection.
708 try: 709 try:
709 import presubmit_support 710 import presubmit_support
710 root_presubmit = checkouts[0].ReadRootFile('PRESUBMIT.py') 711 root_presubmit = checkouts[0].ReadRootFile('PRESUBMIT.py')
711 options.bot = presubmit_support.DoGetTrySlaves( 712 options.bot = presubmit_support.DoGetTrySlaves(
713 change,
712 checkouts[0].GetFileNames(), 714 checkouts[0].GetFileNames(),
713 checkouts[0].checkout_root, 715 checkouts[0].checkout_root,
714 root_presubmit, 716 root_presubmit,
715 options.project, 717 options.project,
716 False, 718 False,
717 sys.stdout) 719 sys.stdout)
718 except ImportError: 720 except ImportError:
719 pass 721 pass
720 # If no bot is specified, either the default pool will be selected or the 722 # If no bot is specified, either the default pool will be selected or the
721 # try server will refuse the job. Either case we don't need to interfere. 723 # try server will refuse the job. Either case we don't need to interfere.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 print >> sys.stderr, e 762 print >> sys.stderr, e
761 return 1 763 return 1
762 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 764 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
763 print >> sys.stderr, e 765 print >> sys.stderr, e
764 return 1 766 return 1
765 return 0 767 return 0
766 768
767 769
768 if __name__ == "__main__": 770 if __name__ == "__main__":
769 fix_encoding.fix_encoding() 771 fix_encoding.fix_encoding()
770 sys.exit(TryChange(None, [], False)) 772 sys.exit(TryChange(None, None, [], False))
OLDNEW
« presubmit_support.py ('K') | « tests/presubmit_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698