| Index: third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py
|
| index bab2b1cb1ab3ccaa8096bdda13751c06f49c3701..b83c2f32b684686e2ce1e0a3e5fb315acc00699b 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py
|
| @@ -130,3 +130,23 @@ def current_build_link(host):
|
| if not (master_name and builder_name and build_number):
|
| return None
|
| return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master_name, builder_name, build_number)
|
| +
|
| +
|
| +def filter_latest_builds(builds):
|
| + """Filters Build objects to include only the latest for each builder.
|
| +
|
| + Args:
|
| + builds: A collection of Build objects.
|
| +
|
| + Returns:
|
| + A list of Build objects; only one Build object per builder name. If
|
| + there are only Builds with no build number, then one is kept; if there
|
| + are Builds with build numbers, then the one with the highest build
|
| + number is kept.
|
| + """
|
| + latest_builds = {}
|
| + for build in builds:
|
| + builder = build.builder_name
|
| + if builder not in latest_builds or build.build_number > latest_builds[builder].build_number:
|
| + latest_builds[builder] = build
|
| + return sorted(latest_builds.values())
|
|
|