[Buildbot-commits] buildbot/buildbot/status/web base.py, 1.15, 1.16 baseweb.py, 1.26, 1.27 waterfall.py, 1.22, 1.23

Brian Warner warner at users.sourceforge.net
Sun Sep 30 09:24:05 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2538/buildbot/status/web

Modified Files:
	base.py baseweb.py waterfall.py 
Log Message:
[project @ web: handle branch=trunk usefully]

Original author: warner at lothar.com
Date: 2007-09-30 09:23:10+00:00

Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/base.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- base.py	30 Sep 2007 09:23:57 -0000	1.15
+++ base.py	30 Sep 2007 09:24:03 -0000	1.16
@@ -333,3 +333,10 @@
         fmt_pieces.append('<a href="%(buildurl)s">#%(buildnum)d</a>:')
         data = " ".join(fmt_pieces) % values
         return data
+
+def map_branches(branches):
+    # when the query args say "trunk", present that to things like
+    # IBuilderStatus.generateFinishedBuilds as None, since that's the
+    # convention in use. In the long run we should clean this up better,
+    # maybe with Branch objects or something.
+    return [b != "trunk" and b or None for b in branches]

Index: baseweb.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/baseweb.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- baseweb.py	30 Sep 2007 09:23:57 -0000	1.26
+++ baseweb.py	30 Sep 2007 09:24:03 -0000	1.27
@@ -11,7 +11,7 @@
 from buildbot.interfaces import IControl, IStatusReceiver
 
 from buildbot.status.web.base import HtmlResource, Box, \
-     build_get_class, ICurrentBox, OneLineMixin
+     build_get_class, ICurrentBox, OneLineMixin, map_branches
 from buildbot.status.web.waterfall import WaterfallStatusResource
 from buildbot.status.web.changes import ChangesResource
 from buildbot.status.web.builder import BuildersResource
@@ -93,13 +93,14 @@
         builders = req.args.get("builder", [])
         branches = [b for b in req.args.get("branch", []) if b]
 
-        g = status.generateFinishedBuilds(builders, branches, numbuilds)
+        g = status.generateFinishedBuilds(builders, map_branches(branches),
+                                          numbuilds)
 
         data = ""
 
         # really this is "up to %d builds"
         data += "<h1>Last %d finished builds: %s</h1>\n" % \
-                (numbuilds, " ".join(branches))
+                (numbuilds, ", ".join(branches))
         if builders:
             data += ("<p>of builders: %s</p>\n" % (", ".join(builders)))
         data += "<ul>\n"
@@ -131,11 +132,12 @@
         branches = [b for b in req.args.get("branch", []) if b]
 
         # walk backwards through all builds of a single builder
-        g = self.builder.generateFinishedBuilds(branches, numbuilds)
+        g = self.builder.generateFinishedBuilds(map_branches(branches),
+                                                numbuilds)
 
         data = ""
-        data += ("<h1>Last %d builds of builder: %s</h1>\n" %
-                 (numbuilds, self.builder_name))
+        data += ("<h1>Last %d builds of builder %s: %s</h1>\n" %
+                 (numbuilds, self.builder_name, ", ".join(branches)))
         data += "<ul>\n"
         got = 0
         for build in g:
@@ -169,13 +171,13 @@
 
         data = ""
 
-        data += "<h2>Latest builds: %s</h2>\n" % " ".join(branches)
+        data += "<h2>Latest builds: %s</h2>\n" % ", ".join(branches)
         data += "<table>\n"
         for bn in builders:
             builder = status.getBuilder(bn)
             data += "<tr>\n"
             data += '<td class="box">%s</td>\n' % html.escape(bn)
-            builds = list(builder.generateFinishedBuilds(branches,
+            builds = list(builder.generateFinishedBuilds(map_branches(branches),
                                                          num_builds=1))
             if builds:
                 b = builds[0]

Index: waterfall.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/waterfall.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- waterfall.py	28 Sep 2007 09:33:40 -0000	1.22
+++ waterfall.py	30 Sep 2007 09:24:03 -0000	1.23
@@ -12,7 +12,7 @@
 from buildbot.status import builder
 
 from buildbot.status.web.base import Box, HtmlResource, IBox, ICurrentBox, \
-     ITopBox, td, build_get_class, path_to_build, path_to_step
+     ITopBox, td, build_get_class, path_to_build, path_to_step, map_branches
 
 
 
@@ -100,8 +100,9 @@
     def getBox(self, req):
         assert interfaces.IBuilderStatus(self.original)
         branches = [b for b in req.args.get("branch", []) if b]
-        builds = list(self.original.generateFinishedBuilds(branches,
-                                                           num_builds=1))
+        builder = self.original
+        builds = list(builder.generateFinishedBuilds(map_branches(branches),
+                                                     num_builds=1))
         if not builds:
             return Box(["none"], "white", class_="LastBuild")
         b = builds[0]
@@ -638,6 +639,7 @@
         if request.args.get("show_events", ["true"])[0].lower() == "true":
             showEvents = True
         filterBranches = [b for b in request.args.get("branch", []) if b]
+        filterBranches = map_branches(filterBranches)
         maxTime = int(request.args.get("last_time", [util.now()])[0])
         if "show_time" in request.args:
             minTime = maxTime - int(request.args["show_time"][0])





More information about the Commits mailing list