Skip to content

Commit

Permalink
Adding flag for choosing ordering scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
abyx committed Dec 22, 2009
1 parent 939588b commit 6c5ae79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 11 additions & 2 deletions buildbot/status/web/baseweb.py
Expand Up @@ -399,7 +399,8 @@ class WebStatus(service.MultiService):

def __init__(self, http_port=None, distrib_port=None, allowForce=False,
public_html="public_html", site=None, numbuilds=20,
num_events=200, num_events_max=None, auth=None):
num_events=200, num_events_max=None, auth=None,
order_console_by_time=False):
"""Run a web server that provides Buildbot status.
@type http_port: int or L{twisted.application.strports} string
Expand Down Expand Up @@ -463,6 +464,11 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
to the C{allowForce} features. Ignored if C{allowForce}
is not C{True}. If C{auth} is C{None}, people can force or
stop builds without auth.
@type order_console_by_time: bool
@param order_console_by_time: Whether to order changes (commits) in the console
view according to the time they were created (for VCS like Git) or
according to their integer revision numbers (for VCS like SVN).
"""

service.MultiService.__init__(self)
Expand Down Expand Up @@ -491,6 +497,8 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
" set to True use this")
self.auth = None

self.orderConsoleByTime = order_console_by_time

# If we were given a site object, go ahead and use it.
if site:
self.site = site
Expand Down Expand Up @@ -530,7 +538,8 @@ def setupUsualPages(self, numbuilds, num_events, num_events_max):
self.putChild("waterfall", WaterfallStatusResource(num_events=num_events,
num_events_max=num_events_max))
self.putChild("grid", GridStatusResource())
self.putChild("console", ConsoleStatusResource())
self.putChild("console", ConsoleStatusResource(
orderByTime=self.orderConsoleByTime))
self.putChild("tgrid", TransposedGridStatusResource())
self.putChild("builders", BuildersResource()) # has builds/steps/logs
self.putChild("changes", ChangesResource())
Expand Down
7 changes: 5 additions & 2 deletions buildbot/status/web/console.py
Expand Up @@ -79,7 +79,7 @@ class ConsoleStatusResource(HtmlResource):
over for sourcestamp, we do number comparaison. I.E. If gotRevision is 1000,
then revision 999 has been tested it in, because 1000 > 999"""

def __init__(self, allowForce=True, css=None):
def __init__(self, allowForce=True, css=None, orderByTime=False):
HtmlResource.__init__(self)

self.status = None
Expand All @@ -90,7 +90,10 @@ def __init__(self, allowForce=True, css=None):
self.allowForce = allowForce
self.css = css

self.comparator = IntegerRevisionComparator()
if orderByTime:
self.comparator = TimeRevisionComparator()
else:
self.comparator = IntegerRevisionComparator()

def getTitle(self, request):
status = self.getStatus(request)
Expand Down

0 comments on commit 6c5ae79

Please sign in to comment.