[Buildbot-commits] buildbot/buildbot scheduler.py,1.8,1.9

Brian Warner warner at users.sourceforge.net
Fri Nov 25 23:26:37 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9304/buildbot

Modified Files:
	scheduler.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-436
Creator:  Brian Warner <warner at lothar.com>

fix AnyBranchScheduler when fileIsImportant=None

	* buildbot/scheduler.py (Scheduler): change fileIsImportant
	handling: treat self.fileIsImportant more as an attribute that
	contains a callable than as a method. If the attribute is None,
	don't call it and assume all filenames are important. It is still
	possible to provide a fileIsImportant method in a subclass,
	however.
	(AnyBranchScheduler): handle fileIsImportant=None, previously it
	was broken
	* buildbot/test/test_scheduler.py (Scheduling.testAnyBranch2):
	test using AnyBranchScheduler with fileIsImportant=None


Index: scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scheduler.py	24 Nov 2005 23:59:25 -0000	1.8
+++ scheduler.py	25 Nov 2005 23:26:35 -0000	1.9
@@ -70,9 +70,10 @@
     should trigger a new build.
     """
 
+    fileIsImportant = None
     compare_attrs = ('name', 'treeStableTimer', 'builderNames', 'branch',
                      'fileIsImportant')
-
+    
     def __init__(self, name, branch, treeStableTimer, builderNames,
                  fileIsImportant=None):
         """
@@ -121,18 +122,13 @@
             return [self.nextBuildTime]
         return []
 
-    def fileIsImportant(self, change):
-        # note that externally-provided fileIsImportant callables are
-        # functions, not methods, and will only receive one argument. Or you
-        # can override this method, in which case it will behave like a
-        # normal method.
-        return True
-
     def addChange(self, change):
         if change.branch != self.branch:
             log.msg("%s ignoring off-branch %s" % (self, change))
             return
-        if self.fileIsImportant(change):
+        if not self.fileIsImportant:
+            self.addImportantChange(change)
+        elif self.fileIsImportant(change):
             self.addImportantChange(change)
         else:
             self.addUnimportantChange(change)
@@ -187,6 +183,7 @@
     separate Scheduler for each new branch it sees."""
 
     schedulerFactory = Scheduler
+    fileIsImportant = None
 
     compare_attrs = ('name', 'branches', 'treeStableTimer', 'builderNames',
                      'fileIsImportant')





More information about the Commits mailing list