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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py

Issue 2692423005: rebaseline-cl: Get latest try jobs using git-cl when no --issue given. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009, Google Inc. All rights reserved. 1 # Copyright (c) 2009, Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 124
125 def current_build_link(host): 125 def current_build_link(host):
126 """Returns a link to the current job if running on buildbot, or None.""" 126 """Returns a link to the current job if running on buildbot, or None."""
127 master_name = host.environ.get('BUILDBOT_MASTERNAME') 127 master_name = host.environ.get('BUILDBOT_MASTERNAME')
128 builder_name = host.environ.get('BUILDBOT_BUILDERNAME') 128 builder_name = host.environ.get('BUILDBOT_BUILDERNAME')
129 build_number = host.environ.get('BUILDBOT_BUILDNUMBER') 129 build_number = host.environ.get('BUILDBOT_BUILDNUMBER')
130 if not (master_name and builder_name and build_number): 130 if not (master_name and builder_name and build_number):
131 return None 131 return None
132 return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master_nam e, builder_name, build_number) 132 return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master_nam e, builder_name, build_number)
133
134
135 def filter_latest_builds(builds):
136 """Filters Build objects to include only the latest for each builder.
137
138 Args:
139 builds: A collection of Build objects.
140
141 Returns:
142 A list of Build objects; only one Build object per builder name. If
143 there are only Builds with no build number, then one is kept; if there
144 are Builds with build numbers, then the one with the highest build
145 number is kept. Builds with the highest
146 """
147 builder_to_latest_build = {}
148 for build in builds:
149 if build.builder_name not in builder_to_latest_build:
150 builder_to_latest_build[build.builder_name] = build
151 elif build.build_number > builder_to_latest_build[build.builder_name].bu ild_number:
152 builder_to_latest_build[build.builder_name] = build
wkorman 2017/02/17 23:24:00 Same as two lines up -- could turn these 4 lines i
qyearsley 2017/02/17 23:45:34 Yep! Good catch. Now removed this repetition.
153 return sorted(builder_to_latest_build.values())
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698