Skip to content

Commit

Permalink
Merge branch 'changes' of git://github.com/chasephillips/buildbot
Browse files Browse the repository at this point in the history
* 'changes' of git://github.com/chasephillips/buildbot:
  Add changeAdded status notifications.
  • Loading branch information
Dustin J. Mitchell committed Feb 5, 2010
2 parents 61049c1 + fa28452 commit 9578207
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions buildbot/interfaces.py
Expand Up @@ -935,6 +935,10 @@ def buildETAUpdate(build, ETA):
"""This is a periodic update on the progress this Build has made
towards completion."""

def changeAdded(change):
"""A new Change was added to the ChangeMaster. By the time this event
is received, all schedulers have already received the change."""

def stepStarted(build, step):
"""A step has just started. 'step' is the IBuildStepStatus which
represents the step: it can be queried for more information.
Expand Down
1 change: 1 addition & 0 deletions buildbot/master.py
Expand Up @@ -989,6 +989,7 @@ def addNewOnes(res):
def addChange(self, change):
for s in self.allSchedulers():
s.addChange(change)
self.status.changeAdded(change)

def submitBuildSet(self, bs):
# determine the set of Builders to use
Expand Down
3 changes: 3 additions & 0 deletions buildbot/status/base.py
Expand Up @@ -29,6 +29,9 @@ def buildStarted(self, builderName, build):
def buildETAUpdate(self, build, ETA):
pass

def changeAdded(self, change):
pass

def stepStarted(self, build, step):
pass

Expand Down
4 changes: 4 additions & 0 deletions buildbot/status/builder.py
Expand Up @@ -2377,3 +2377,7 @@ def buildsetSubmitted(self, bss):
bss.waitUntilFinished().addCallback(self.activeBuildSets.remove)
for t in self.watchers:
t.buildsetSubmitted(bss)

def changeAdded(self, change):
for t in self.watchers:
t.changeAdded(change)
20 changes: 20 additions & 0 deletions buildbot/test/runs/test_status.py
Expand Up @@ -1056,6 +1056,9 @@ def buildStarted(self, name, build):
def buildETAUpdate(self, build, ETA):
self.events.append(("buildETAUpdate", build, ETA))
self.announce()
def changeAdded(self, change):
self.events.append(("changeAdded", change))
self.announce()
def stepStarted(self, build, step):
self.events.append(("stepStarted", build, step))
self.announce()
Expand Down Expand Up @@ -1090,6 +1093,23 @@ def builderRemoved(self, name):
self.events.append(("builderRemoved", name))
self.announce()

class VerifyChangeAdded(RunMixin, unittest.TestCase):
def testChangeAdded(self):
m = self.master

s = m.getStatus()
self.t1 = t1 = STarget(["builder"])
s.subscribe(t1)

m.loadConfig(config_2)
m.readConfig = True
m.startService()

cm = self.master.change_svc
c = Change("bob", ["Makefile", "foo/bar.c"], "changed stuff")
cm.addChange(c)
self.failUnlessEqual(t1.events[-1], ("changeAdded", c))

class Subscription(RunMixin, unittest.TestCase):
# verify that StatusTargets can subscribe/unsubscribe properly

Expand Down

0 comments on commit 9578207

Please sign in to comment.