[Buildbot-commits] buildbot/buildbot/changes bonsaipoller.py, 1.7, 1.8

Brian Warner warner at users.sourceforge.net
Tue Apr 29 20:21:29 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot/changes
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30745/buildbot/changes

Modified Files:
	bonsaipoller.py 
Log Message:
[project @ bonsaipoller: apply fixes from Ben Hearsum, closes #216]

Original author: warner at lothar.com
Date: 2008-04-29 16:21:08+00:00

Index: bonsaipoller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/bonsaipoller.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- bonsaipoller.py	29 Sep 2007 22:51:40 -0000	1.7
+++ bonsaipoller.py	29 Apr 2008 20:21:27 -0000	1.8
@@ -184,12 +184,7 @@
         return filename
 
     def _getRevision(self):
-        """Returns the revision of the current <f> node"""
-        rev = self.currentFileNode.getAttribute("rev")
-        if rev == "":
-            raise InvalidResultError("A revision was missing from a file")
-
-        return rev
+        return self.currentFileNode.getAttribute("rev")
 
 
 class BonsaiPoller(base.ChangeSource):
@@ -224,7 +219,8 @@
         @param  cvsroot:        The cvsroot of the repository. Usually this is
                                 '/cvsroot'
         @type   pollInterval:   int
-        @param  pollInterval:   The time (in seconds) between queries for changes
+        @param  pollInterval:   The time (in seconds) between queries for
+                                changes
         """
 
         self.bonsaiURL = bonsaiURL
@@ -261,18 +257,25 @@
             self.working = True
             d = self._get_changes()
             d.addCallback(self._process_changes)
-            d.addBoth(self._finished)
+            d.addCallbacks(self._finished_ok, self._finished_failure)
         return
 
-    def _finished(self, res):
+    def _finished_ok(self, res):
         assert self.working
         self.working = False
 
-        # check for failure
+        # check for failure -- this is probably never hit but the twisted docs
+        # are not clear enough to be sure. it is being kept "just in case"
         if isinstance(res, failure.Failure):
             log.msg("Bonsai poll failed: %s" % res)
         return res
 
+    def _finished_failure(self, res):
+        log.msg("Bonsai poll failed: %s" % res)
+        assert self.working
+        self.working = False
+        return None # eat the failure
+
     def _make_url(self):
         args = ["treeid=%s" % self.tree, "module=%s" % self.module,
                 "branch=%s" % self.branch, "branchtype=match",





More information about the Commits mailing list