Mercurial > hg > autobot
changeset 101:21ce7537d80d
* fix syntax and indentation errors
* come closer to alignment with buildbot-0.8.3.....is it closer to master? ::shrug::
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 18 Jan 2011 17:54:19 -0800 |
parents | d80e96f7e547 |
children | a09fab386ed7 |
files | autobot/changes/poller.py |
diffstat | 1 files changed, 41 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/autobot/changes/poller.py Tue Jan 18 13:01:58 2011 -0800 +++ b/autobot/changes/poller.py Tue Jan 18 17:54:19 2011 -0800 @@ -19,7 +19,7 @@ from twisted.python import log from twisted.internet import defer, utils -from buildbot.util import deferredLocked +#from buildbot.util import deferredLocked from buildbot.changes import base class Poller(base.PollingChangeSource): @@ -34,7 +34,7 @@ def __init__(self, repourl, binary=None, branch=None, workdir=None, pollInterval=10*60, - binary=None, usetimestamps=True, + usetimestamps=True, category=None, project=None, pollinterval=-2): @@ -64,6 +64,8 @@ def startService(self): + base.PollingChangeSource.startService(self) + # initialize the repository we'll use to get changes; note that # startService is not an event-driven method, so this method will # instead acquire self.initLock immediately when it is called. @@ -74,9 +76,8 @@ log.msg("%s repository already exists" % self.name) # call this *after* initRepository, so that the initLock is locked first - base.PollingChangeSource.startService(self) - @deferredLocked('initLock') + def initRepository(self): """initialize a repository or whatever""" @@ -101,7 +102,7 @@ # finish up def log_finished(_): - log.msg("%s: finished initializing working dir from %s" % (self.name, self.repourl) + log.msg("%s: finished initializing working dir from %s" % (self.name, self.repourl)) d.addCallback(log_finished) return d @@ -113,7 +114,6 @@ % (self.name, self.repourl, self.branch, status) return str - @deferredLocked('initLock') def poll(self): d = self._get_changes() d.addCallback(self._process_changes) @@ -121,7 +121,6 @@ d.addCallback(self._catch_up) d.addErrback(self._catch_up_failure) return d - @defer.deferredGenerator def _get_changes(self): @@ -231,16 +230,16 @@ return f -class HGPoller(Poller): +class HgPoller(Poller): """poller for a mercurial source""" def __init__(self, repourl, binary='hg', branch='default', **kwargs): Poller.__init__(self, repourl, binary=binary, branch=branch, **kwargs) def isInitialized(self): - return os.path.exists(os.path.join(self.workdir), '.hg') + return os.path.exists(os.path.join(self.workdir, '.hg')) - def itializationCommands(self): + def initializationCommands(self): return [ [ 'clone', self.repourl ] ] def _fetch(self): @@ -257,7 +256,7 @@ @defer.deferredGenerator - def _hash(self) + def _hash(self): d = utils.getProcessOutput(self.binary, ['tip', '--template', '{node}\\n'], path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) @@ -305,36 +304,36 @@ d.addCallback(process) return d - def _get_commit_name(self, rev): - """get the author of a commit""" - args = ['log', '-r', rev, '--template', '{author}'] - d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) - def process(output): - stripped_output = output.strip() - if len(stripped_output) == 0: - raise EnvironmentError('could not get commit name for rev') - return stripped_output - d.addCallback(process) - return d + def _get_commit_name(self, rev): + """get the author of a commit""" + args = ['log', '-r', rev, '--template', '{author}'] + d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) + def process(output): + stripped_output = output.strip() + if len(stripped_output) == 0: + raise EnvironmentError('could not get commit name for rev') + return stripped_output + d.addCallback(process) + return d - def _get_commit_files(self, rev): - """get the files associated with a commit""" - args = ['log', '-r', rev, '--template', '{files}'] - d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) - def process(output): - fileList = output.split() - return fileList - d.addCallback(process) - return d + def _get_commit_files(self, rev): + """get the files associated with a commit""" + args = ['log', '-r', rev, '--template', '{files}'] + d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) + def process(output): + fileList = output.split() + return fileList + d.addCallback(process) + return d - def _get_commit_comments(self, rev): - """get the commit message""" - args = ['log', '-r', rev, '--template', '{desc}'] - d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) - def process(output): - stripped_output = output.strip() - if len(stripped_output) == 0: - raise EnvironmentError('could not get commit comment for rev') - return stripped_output - d.addCallback(process) - return d + def _get_commit_comments(self, rev): + """get the commit message""" + args = ['log', '-r', rev, '--template', '{desc}'] + d = utils.getProcessOutput(self.binary, args, path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False ) + def process(output): + stripped_output = output.strip() + if len(stripped_output) == 0: + raise EnvironmentError('could not get commit comment for rev') + return stripped_output + d.addCallback(process) + return d