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

Unified Diff: git_cl.py

Issue 447363002: Auto find tryserver master for git cl try (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 77f4a9e9f13c769e02e6acdadb087acb64f05224..398751cf64ecb52e72c7e3b1f3e1826d235a7265 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2231,10 +2231,10 @@ def CMDtry(parser, args):
"-b", "--bot", action="append",
help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple "
"times to specify multiple builders. ex: "
- "'-bwin_rel:ui_tests,webkit_unit_tests -bwin_layout'. See "
+ "'-b win_rel:ui_tests,webkit_unit_tests -b win_layout'. See "
"the try server waterfall for the builders name and the tests "
"available. Can also be used to specify gtest_filter, e.g. "
- "-bwin_rel:base_unittests:ValuesTest.*Value"))
+ "-b win_rel:base_unittests:ValuesTest.*Value"))
group.add_option(
"-m", "--master", default='',
help=("Specify a try master where to run the tries."))
@@ -2276,8 +2276,45 @@ def CMDtry(parser, args):
options.name = cl.GetBranch()
if options.bot and not options.master:
- parser.error('For manually specified bots please also specify the '
- 'tryserver master, e.g. "-m tryserver.chromium.linux".')
+ err_msg = ''
+ map_url = 'http://builders-map.appspot.com/'
Paweł Hajdan Jr. 2014/08/08 11:13:50 This should use HTTPS.
sheyang 2014/08/11 19:30:06 Done.
+ try:
+ res = urllib2.urlopen(map_url)
+ master_map = json.load(res)
+ except urllib2.URLError as url_e:
+ err_msg = ('Fail to fetch builder-to-master map from %s. Error: %s.' %
Paweł Hajdan Jr. 2014/08/08 11:13:50 nit: Fail -> Failed
sheyang 2014/08/11 19:30:05 Done.
+ (map_url, url_e))
+ logging.warn(err_msg)
Paweł Hajdan Jr. 2014/08/08 11:13:50 Why do we need this (here and below) if we actuall
sheyang 2014/08/11 19:30:05 Removed.
+ except ValueError as val_e:
+ err_msg = 'Invalid json string from %s. Error: %s.' % (map_url, val_e)
+ logging.warn(err_msg)
+
+ if master_map:
Paweł Hajdan Jr. 2014/08/08 11:13:50 Have you tested the code path when we catch an exc
sheyang 2014/08/11 19:30:05 Done.
+ for bot in options.bot:
+ if ':' in bot:
+ builder, _ = bot.split(':', 1)
+ else:
+ builder = bot
+ master_list = master_map.get(builder, [])
+ if not master_list:
+ err_msg = 'Cannot find a master for builder %s.' % builder
+ break
+ elif len(master_list) > 1:
+ err_msg = ('The builder name %s exists in multiple masters %s.' %
+ (builder, master_list))
+ break
+ else:
+ cur_master = master_list[0]
+ if not options.master:
+ options.master = cur_master
+ elif options.master != cur_master:
+ err_msg = 'The builders do not belong to the same master.'
+ break
+
+ if err_msg:
+ parser.error('Tryserver master cannot be found because: %s\n'
+ 'Please manually specify the tryserver master'
+ ', e.g. "-m tryserver.chromium.linux".' % err_msg)
def GetMasterMap():
# Process --bot and --testfilter.
« 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