Skip to content

Commit

Permalink
(fixes buildbot#592) store allChanges, rather than trying to concaten…
Browse files Browse the repository at this point in the history
…ate {un,}importantChanges and thereby losing the order of changes
  • Loading branch information
Dustin J. Mitchell committed Jul 18, 2009
1 parent 28b86b7 commit df2e084
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions buildbot/scheduler.py
Expand Up @@ -134,7 +134,7 @@ def __init__(self, name, branch, treeStableTimer, builderNames,
self.fileIsImportant = fileIsImportant

self.importantChanges = []
self.unimportantChanges = []
self.allChanges = []
self.nextBuildTime = None
self.timer = None
self.categories = categories
Expand Down Expand Up @@ -164,13 +164,14 @@ def addChange(self, change):
def addImportantChange(self, change):
log.msg("%s: change is important, adding %s" % (self, change))
self.importantChanges.append(change)
self.allChanges.append(change)
self.nextBuildTime = max(self.nextBuildTime,
change.when + self.treeStableTimer)
self.setTimer(self.nextBuildTime)

def addUnimportantChange(self, change):
log.msg("%s: change is not important, adding %s" % (self, change))
self.unimportantChanges.append(change)
self.allChanges.append(change)

def setTimer(self, when):
log.msg("%s: setting timer to %s" %
Expand All @@ -191,9 +192,9 @@ def fireTimer(self):
# clear out our state
self.timer = None
self.nextBuildTime = None
changes = self.importantChanges + self.unimportantChanges
changes = self.allChanges
self.importantChanges = []
self.unimportantChanges = []
self.allChanges = []

# create a BuildSet, submit it to the BuildMaster
bs = buildset.BuildSet(self.builderNames,
Expand Down Expand Up @@ -487,7 +488,7 @@ def __init__(self, name, builderNames, minute=0, hour='*',
% name)

self.importantChanges = []
self.unimportantChanges = []
self.allChanges = []
self.fileIsImportant = None
if fileIsImportant:
assert callable(fileIsImportant)
Expand Down Expand Up @@ -584,7 +585,7 @@ def doPeriodicBuild(self):

if self.onlyIfChanged:
if len(self.importantChanges) > 0:
changes = self.importantChanges + self.unimportantChanges
changes = self.allChanges
# And trigger a build
log.msg("Nightly Scheduler <%s>: triggering build" % self.name)
bs = buildset.BuildSet(self.builderNames,
Expand All @@ -594,7 +595,7 @@ def doPeriodicBuild(self):
self.submitBuildSet(bs)
# Reset the change lists
self.importantChanges = []
self.unimportantChanges = []
self.allChanges = []
else:
log.msg("Nightly Scheduler <%s>: skipping build - No important change" % self.name)
else:
Expand Down Expand Up @@ -622,11 +623,12 @@ def addChange(self, change):

def addImportantChange(self, change):
log.msg("Nightly Scheduler <%s>: change %s from %s is important, adding it" % (self.name, change.revision, change.who))
self.allChanges.append(change)
self.importantChanges.append(change)

def addUnimportantChange(self, change):
log.msg("Nightly Scheduler <%s>: change %s from %s is not important, adding it" % (self.name, change.revision, change.who))
self.unimportantChanges.append(change)
self.allChanges.append(change)


class TryBase(BaseScheduler):
Expand Down
2 changes: 1 addition & 1 deletion buildbot/test/test_scheduler.py
Expand Up @@ -108,7 +108,7 @@ def testBranch(self):
s.addChange(c3)

self.failUnlessEqual(s.importantChanges, [c1,c3])
self.failUnlessEqual(s.unimportantChanges, [c2])
self.failUnlessEqual(s.allChanges, [c1,c2,c3])
self.failUnless(s.timer)

d = defer.Deferred()
Expand Down

0 comments on commit df2e084

Please sign in to comment.