# HG changeset patch # User Jeff Hammel # Date 1323296303 28800 # Node ID d4637641be6e7f31f8879b957ed042dc94ab6933 # Parent 1084dadf9027ec2abed7dddf5c3ca14b85ecf980 whitespace cleanup; logging diff -r 1084dadf9027 -r d4637641be6e autobot/changes/poller.py --- 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)