Package buildbot :: Package changes :: Module manager
[frames] | no frames]

Source Code for Module buildbot.changes.manager

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  from zope.interface import implements 
17  from twisted.internet import defer 
18  from twisted.application import service 
19   
20  from buildbot import interfaces 
21   
22 -class ChangeManager(service.MultiService):
23 """ 24 This is the master-side service which receives file change notifications 25 from version-control systems. 26 27 It is a Twisted service, which has instances of 28 L{buildbot.interfaces.IChangeSource} as child services. These are added by 29 the master with C{addSource}. 30 """ 31 32 implements(interfaces.IEventSource) 33 34 lastPruneChanges = None 35 name = "changemanager" 36
37 - def __init__(self):
38 service.MultiService.__init__(self) 39 self.master = None 40 self.lastPruneChanges = 0
41
42 - def startService(self):
43 service.MultiService.startService(self) 44 self.master = self.parent
45
46 - def addSource(self, source):
47 assert interfaces.IChangeSource.providedBy(source) 48 assert service.IService.providedBy(source) 49 source.master = self.master 50 source.setServiceParent(self)
51
52 - def removeSource(self, source):
53 assert source in self 54 d = defer.maybeDeferred(source.disownServiceParent) 55 def unset_master(x): 56 source.master = None 57 return x
58 d.addBoth(unset_master) 59 return d
60