Ticket #2364: consoleusetimefromrevision.diff

File consoleusetimefromrevision.diff, 3.7 KB (added by pepsiman, 7 years ago)

Patch to use the time from the revision as the time of the build

  • master/buildbot/status/web/console.py

    diff --git a/master/buildbot/status/web/console.py b/master/buildbot/status/web/console.py
    index 5615afc..bfe43e2 100644
    a b class DevRevision: 
    7676class DevBuild:
    7777    """Helper class that contains all the information we need for a build."""
    7878
    79     def __init__(self, revision, build, details):
     79    def __init__(self, revision, build, details, revisions=[]):
    8080        self.revision = revision
    8181        self.results =  build.getResults()
    8282        self.number = build.getNumber()
    class DevBuild: 
    8888        #TODO: support multiple sourcestamps
    8989        self.source = build.getSourceStamps()[0]
    9090
     91        for rev in revisions:
     92            if rev.revision == revision:
     93                self.when = rev.when
     94                break
     95
    9196
    9297class ConsoleStatusResource(HtmlResource):
    9398    """Main console class. It displays a user-oriented status page.
    class ConsoleStatusResource(HtmlResource): 
    221226        return details
    222227
    223228    def getBuildsForRevision(self, request, builder, builderName, codebase,
    224                              lastRevision, numBuilds, debugInfo):
     229                             revisions, lastRevision, numBuilds, debugInfo):
    225230        """Return the list of all the builds for a given builder that we will
    226231        need to be able to display the console page. We start by the most recent
    227232        build, and we go down until we find a build that was built prior to the
    class ConsoleStatusResource(HtmlResource): 
    257262            if got_rev is not None:
    258263                number += 1
    259264                details = self.getBuildDetails(request, builderName, build)
    260                 devBuild = DevBuild(got_rev, build, details)
     265                devBuild = DevBuild(got_rev, build, details, revisions)
    261266                builds.append(devBuild)
    262267
    263268                # Now break if we have enough builds.
    class ConsoleStatusResource(HtmlResource): 
    284289        changes.sort(key=self.comparator.getSortingKey())
    285290        return changes[-1]
    286291   
    287     def getAllBuildsForRevision(self, status, request, codebase, lastRevision,
    288                                 numBuilds, categories, builders, debugInfo):
     292    def getAllBuildsForRevision(self, status, request, codebase, revisions,
     293                                lastRevision, numBuilds, categories, builders,
     294                                debugInfo):
    289295        """Returns a dictionary of builds we need to inspect to be able to
    290296        display the console page. The key is the builder name, and the value is
    291297        an array of build we care about. We also returns a dictionary of
    class ConsoleStatusResource(HtmlResource): 
    334340                                                               builder,
    335341                                                               builderName,
    336342                                                               codebase,
     343                                                               revisions,
    337344                                                               lastRevision,
    338345                                                               numBuilds,
    339346                                                               debugInfo)
    class ConsoleStatusResource(HtmlResource): 
    676683                (builderList, allBuilds) = self.getAllBuildsForRevision(status,
    677684                                                    request,
    678685                                                    codebase,
     686                                                    revisions,
    679687                                                    lastRevision,
    680688                                                    numBuilds,
    681689                                                    categories,