Skip to content

Commit

Permalink
Workaround for buildbot#601 in console.
Browse files Browse the repository at this point in the history
 - This should really be fixed by fixing getBuild()...
  • Loading branch information
ddunbar authored and nsylvain committed Aug 31, 2009
1 parent 16ec41a commit 474be07
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions buildbot/status/web/console.py
Expand Up @@ -127,6 +127,18 @@ def head(self, request):
## Data gathering functions
##

def getHeadBuild(self, builder):
"""Get the most recent build for the given builder.
"""
build = builder.getBuild(-1)

# HACK: Work around #601, the head build may be None if it is
# locked.
if build is None:
build = builder.getBuild(-2)

return build

def fetchChangesFromHistory(self, status, max_depth, max_builds, debugInfo):
"""Look at the history of the builders and try to fetch as many changes
as possible. We need this when the main source does not contain enough
Expand All @@ -147,7 +159,7 @@ def fetchChangesFromHistory(self, status, max_depth, max_builds, debugInfo):
break

builder = status.getBuilder(builderName)
build = builder.getBuild(-1)
build = self.getHeadBuild(builder)
depth = 0
while build and depth < max_depth and build_count < max_builds:
depth += 1
Expand Down Expand Up @@ -268,7 +280,7 @@ def getBuildsForRevision(self, request, builder, builderName, lastRevision,
revision = lastRevision

builds = []
build = builder.getBuild(-1)
build = self.getHeadBuild(builder)
number = 0
while build and number < numBuilds:
debugInfo["builds_scanned"] += 1
Expand Down Expand Up @@ -461,7 +473,7 @@ def displaySlaveLine(self, status, builderList, debugInfo, subs):
else:
# If not offline, then display the result of the last
# finished build.
build = status.getBuilder(builder).getBuild(-1)
build = self.getHeadBuild(status.getBuilder(builder))
while build and not build.isFinished():
build = build.getPreviousBuild()

Expand Down

0 comments on commit 474be07

Please sign in to comment.