Mercurial > hg > autobot
changeset 231:d4637641be6e
whitespace cleanup; logging
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 07 Dec 2011 14:18:23 -0800 |
parents | 1084dadf9027 |
children | ec60fe53c36c |
files | autobot/changes/poller.py |
diffstat | 1 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/autobot/changes/poller.py Tue Nov 29 20:44:33 2011 -0800 +++ b/autobot/changes/poller.py Wed Dec 07 14:18:23 2011 -0800 @@ -26,13 +26,13 @@ This will poll a remote resource for changes and submit them to the change master. """ - + compare_attrs = ["repourl", "branch", "workdir", "pollInterval", "binary", "usetimestamps", "category", "project"] - + def __init__(self, repourl, binary=None, branch=None, - workdir=None, pollInterval=10*60, + workdir=None, pollInterval=10*60, usetimestamps=True, category=None, project=None, pollinterval=-2): @@ -55,7 +55,7 @@ self.changeCount = 0 self.commitInfo = {} self.initLock = defer.DeferredLock() - + if not self.workdir: self.workdir = tempfile.mkdtemp() @@ -109,7 +109,7 @@ # seems actually to get called # i don't know....all i do know is that i'm tired of writing # twisted code - + # finish up def log_finished(_): log.msg("%s: finished initializing working dir %s from %s" % (self.name, self.workdir, self.repourl)) @@ -129,13 +129,13 @@ def poll(self): """poll for new changes""" - + d = self._get_changes() d.addCallback(self._process_changes) d.addErrback(self._process_changes_failure) d.addCallback(self._catch_up) d.addErrback(self._catch_up_failure) - return d + return d ### functions relating to hashing @@ -169,7 +169,7 @@ # set the post hash d.addCallback(self._hash) d.addCallback(self._setPostHash) - + return d ### functions related to processing changes @@ -209,11 +209,11 @@ d.addCallback(self._get_commit_files, rev) d.addCallback(self._get_commit_comments, rev) d.addCallback(self._add_change, rev) - return d + return d def _add_change(self, _, rev): log.msg("_add_change results: %s" % self.commitInfo) - + # send the change to the master c = changes.Change(who=self.commitInfo['name'], revision=rev, @@ -233,7 +233,7 @@ log.err(f) # eat the failure to continue along the defered chain - we still want to catch up return None - + def _catch_up_failure(self, f): log.err(f) log.msg('%s: please resolve issues in local repo: %s' % (self.name, self.workdir)) @@ -317,9 +317,9 @@ return [] return changes.split()[1:] d.addCallback(split_changes) - + return d - + def _catch_up(self, rev): if self.changeCount == 0: self.log('%s: no changes, no catch_up' % self.postHash) @@ -432,6 +432,7 @@ commands.append(['--git-dir', git_dir + '/.git', '--work-tree', git_dir, 'checkout', self.branch]) + log.msg('GitPoller: initializationCommands: %s' % commands) return commands def update(self, _): @@ -440,7 +441,7 @@ env=dict(PATH=os.environ['PATH']), errortoo=True) return d - + def _fetch(self, _): d = self.checkoutBranch(None) d.addCallback(self.update) @@ -450,7 +451,7 @@ """ get hash of where you are now: git rev-parse HEAD - """ + """ d = utils.getProcessOutput(self.binary, ['rev-parse', 'HEAD'], path=self.workdir, env=dict(PATH=os.environ['PATH']), errortoo=False)