Skip to content

Commit

Permalink
Using the created classes
Browse files Browse the repository at this point in the history
  • Loading branch information
abyx committed Dec 22, 2009
1 parent 6fba2d3 commit 83a1c28
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions buildbot/status/web/console.py
Expand Up @@ -46,25 +46,27 @@ class ANYBRANCH: pass # a flag value, used below
class DevRevision:
"""Helper class that contains all the information we need for a revision."""

def __init__(self, revision, who, comments, date, revlink):
def __init__(self, revision, who, comments, date, revlink, when):
self.revision = revision
self.comments = comments
self.who = who
self.date = date
self.revlink = revlink
self.when = when


class DevBuild:
"""Helper class that contains all the information we need for a build."""

def __init__(self, revision, results, number, isFinished, text, eta, details):
def __init__(self, revision, results, number, isFinished, text, eta, details, when):
self.revision = revision
self.results = results
self.number = number
self.isFinished = isFinished
self.text = text
self.eta = eta
self.details = details
self.when = when


class ConsoleStatusResource(HtmlResource):
Expand All @@ -88,6 +90,8 @@ def __init__(self, allowForce=True, css=None):
self.allowForce = allowForce
self.css = css

self.comparator = IntegerRevisionComparator()

def getTitle(self, request):
status = self.getStatus(request)
projectName = status.getProjectName()
Expand Down Expand Up @@ -239,7 +243,8 @@ def stripRevisions(self, allChanges, numRevs, branch, devName):

rev = DevRevision(change.revision, change.who,
change.comments, change.getTime(),
getattr(change, 'revlink', None))
getattr(change, 'revlink', None),
change.when)
revisions.append(rev)

return revisions
Expand Down Expand Up @@ -295,19 +300,15 @@ def getBuildsForRevision(self, request, builder, builderName, lastRevision,
got_rev = -1
try:
got_rev = build.getProperty("got_revision")
try:
got_rev = int(got_rev)
except:
if not self.comparator.isValidRevision(got_rev):
got_rev = -1
except KeyError:
pass

try:
if got_rev == -1:
got_rev = build.getProperty("revision")
try:
got_rev = int(got_rev)
except:
if not self.comparator.isValidRevision(got_rev):
got_rev = -1
except:
pass
Expand All @@ -323,12 +324,14 @@ def getBuildsForRevision(self, request, builder, builderName, lastRevision,
build.isFinished(),
build.getText(),
build.getETA(),
details)
details,
build.getTimes()[0])

builds.append(devBuild)

# Now break if we have enough builds.
if int(got_rev) < int(revision):
if self.comparator.isRevisionEarlier(
devBuild, builder.getBuild(-1).getChanges()[-1]):
break

build = build.getPreviousBuild()
Expand Down Expand Up @@ -541,12 +544,12 @@ def displayStatusLine(self, builderList, allBuilds, revision, debugInfo,

# Find the first build that does not include the revision.
for build in allBuilds[builder]:
if int(build.revision) >= int(revision.revision):
introducedIn = build
else:
if self.comparator.isRevisionEarlier(build, revision):
firstNotIn = build
break

else:
introducedIn = build

# Get the results of the first build with the revision, and the
# first build that does not include the revision.
results = None
Expand Down

0 comments on commit 83a1c28

Please sign in to comment.