Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: buildbot-0.8.0
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (60 sloc) 2.27 KB
# Additional Scheduler functions
# Contributor(s):
# Chris AtLee <>
# Lukas Blakk <>
from twisted.python import log
from twisted.internet import defer
from twisted.web.client import getPage
import re
import buildbotcustom.try_parser
from buildbotcustom.try_parser import TryParser
from buildbot.util import json
def tryChooser(s, all_changes):
log.msg("Looking at changes: %s" % all_changes)
buildersPerChange = {}
dl = []
def getJSON(data):
push = json.loads(data)
log.msg("Looking at the push json data for try comments")
for p in push:
pd = push[p]
changes = pd['changesets']
for change in reversed(changes):
match ="try:", change['desc'])
if match:
return change['desc'].encode("utf8", "replace")
def parseData(comments, c):
if not comments:
# still need to parse a comment string to get the default set
log.msg("No comments, passing empty string which will result in default set")
comments = ""
customBuilders = TryParser(comments, s.builderNames)
buildersPerChange[c] = customBuilders
def parseDataError(failure, c):
log.msg("Couldn't parse data: Requesting default try set.")
parseData("", c)
for c in all_changes:
match ="try", c.branch)
if not match:
log.msg("Ignoring off-branch %s" % c.branch)
# Look in comments first for try: syntax
match ="try:", c.comments)
if match:
log.msg("Found try message in the change comments, ignoring push comments")
d = defer.succeed(c.comments)
# otherwise getPage from hg.m.o
d = getPage(str("" % c.revision))
log.msg("Error in all_changes loop: sending default try set")
d = defer.succeed("")
d.addCallback(parseData, c)
d.addErrback(parseDataError, c)
d = defer.DeferredList(dl)
d.addCallback(lambda res: buildersPerChange)
return d
Jump to Line
Something went wrong with that request. Please try again.