changeset 245:5f286f64ce6e

convert to a datetime; i guess you gotta do that now
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 22 Dec 2011 15:46:05 -0800
parents 714a7a7f4ea7
children 76ef1a33e345
files autobot/changes/poller.py
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/changes/poller.py	Thu Dec 22 15:39:00 2011 -0800
+++ b/autobot/changes/poller.py	Thu Dec 22 15:46:05 2011 -0800
@@ -16,6 +16,7 @@
 import os
 import time
 import tempfile
+from datetime import datetime
 from twisted.python import log
 from twisted.internet import defer, utils
 
@@ -27,6 +28,8 @@
     them to the change master.
     """
 
+    src = ''
+
     compare_attrs = ["repourl", "branch", "workdir",
                      "pollInterval", "binary", "usetimestamps",
                      "category", "project"]
@@ -214,7 +217,12 @@
     def _add_change(self, _, rev):
         log.msg("_add_change results: %s" % self.commitInfo)
 
+        # convert the timestamp into a datetime object
+        # (required in buildbot 0.8.5)
         timestamp = self.commitInfo['timestamp']
+        if isinstance(timestamp, int) or isinstance(timestamp, float):
+            timestamp = datetime.fromtimestamp(timestamp)
+
         self.log('timestamp: %s' % timestamp)
 
         # send the change to the master
@@ -237,7 +245,7 @@
                               category=self.category,
                               project=self.project,
                               repository=self.repourl,
-                              src=self.name)
+                              src=self.src)
         self.lastChange = self.lastPoll
 
 
@@ -272,6 +280,8 @@
 class HgPoller(Poller):
     """poller for a mercurial source"""
 
+    src = 'hg'
+
     def __init__(self, repourl, binary='hg', branch='default', **kwargs):
         Poller.__init__(self, repourl, binary=binary, branch=branch, **kwargs)
 
@@ -416,6 +426,8 @@
 
 class GitPoller(Poller):
 
+    src = 'git'
+
     def __init__(self, repourl, binary='git', branch='master', **kwargs):
         Poller.__init__(self, repourl, binary=binary, branch=branch, **kwargs)