[Buildbot-commits] buildbot/buildbot scheduler.py,1.7,1.8
Brian Warner
warner at users.sourceforge.net
Thu Nov 24 23:59:27 UTC 2005
Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26376/buildbot
Modified Files:
scheduler.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-430
Creator: Brian Warner <warner at lothar.com>
minor changes to AnyBranchScheduler
* buildbot/scheduler.py (AnyBranchScheduler): fix branches=[] to
mean "don't build anything", and add a warning if it gets used
because it isn't actually useful.
Index: scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scheduler.py 31 Aug 2005 01:51:41 -0000 1.7
+++ scheduler.py 24 Nov 2005 23:59:25 -0000 1.8
@@ -196,9 +196,12 @@
"""
@param name: the name of this Scheduler
@param branches: The branch names that the Scheduler should pay
- attention to. Any Change that is not on one of these
- branches will be ignored. It can be set to None to
- accept changes from any branch.
+ attention to. Any Change that is not on one of these
+ branches will be ignored. It can be set to None to
+ accept changes from any branch. Don't use [] (an
+ empty list), because that means we don't pay
+ attention to *any* branches, so we'll never build
+ anything.
@param treeStableTimer: the duration, in seconds, for which the tree
must remain unchanged before a build will be
triggered. This is intended to avoid builds
@@ -222,11 +225,22 @@
assert type(b) is str
self.builderNames = builderNames
self.branches = branches
+ if self.branches == []:
+ log.msg("AnyBranchScheduler %s: branches=[], so we will ignore "
+ "all branches, and never trigger any builds. Please set "
+ "branches=None to mean 'all branches'" % self)
+ # consider raising an exception here, to make this warning more
+ # prominent, but I can vaguely imagine situations where you might
+ # want to comment out branches temporarily and wouldn't
+ # appreciate it being treated as an error.
if fileIsImportant:
assert callable(fileIsImportant)
self.fileIsImportant = fileIsImportant
self.schedulers = {} # one per branch
+ def __repr__(self):
+ return "<AnyBranchScheduler '%s'>" % self.name
+
def listBuilderNames(self):
return self.builderNames
@@ -239,7 +253,7 @@
def addChange(self, change):
branch = change.branch
- if self.branches and branch not in self.branches:
+ if self.branches is not None and branch not in self.branches:
log.msg("%s ignoring off-branch %s" % (self, change))
return
s = self.schedulers.get(branch)
More information about the Commits
mailing list