[Buildbot-commits] buildbot/buildbot/changes p4poller.py,1.9,1.10

Brian Warner warner at users.sourceforge.net
Sun Apr 15 01:28:48 UTC 2007


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

Modified Files:
	p4poller.py 
Log Message:
[project @ web-parts: start rearranging web status files]

Original author: warner at lothar.com

Date: 2007-02-27 20:33:22+00:00

Index: p4poller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/p4poller.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- p4poller.py	28 Feb 2007 06:27:49 -0000	1.9
+++ p4poller.py	15 Apr 2007 01:28:46 -0000	1.10
@@ -28,7 +28,7 @@
     them to the change master."""
 
     compare_attrs = ["p4port", "p4user", "p4passwd", "p4base",
-                     "p4bin", "pollinterval"]
+                     "p4bin", "pollinterval", "histmax"]
 
     changes_line_re = re.compile(
             r"Change (?P<num>\d+) on \S+ by \S+@\S+ '.+'$")
@@ -45,7 +45,7 @@
     def __init__(self, p4port=None, p4user=None, p4passwd=None,
                  p4base='//', p4bin='p4',
                  split_file=lambda branchfile: (None, branchfile),
-                 pollinterval=60 * 10, histmax=None):
+                 pollinterval=60 * 10, histmax=100):
         """
         @type  p4port:       string
         @param p4port:       p4 port definition (host:portno)
@@ -63,8 +63,7 @@
         @type  pollinterval: int
         @param pollinterval: interval in seconds between polls
         @type  histmax:      int
-        @param histmax:      (obsolete) maximum number of changes to look back through.
-                             ignored; accepted for backwards compatibility.
+        @param histmax:      maximum number of changes to look back through
         """
 
         self.p4port = p4port
@@ -74,6 +73,7 @@
         self.p4bin = p4bin
         self.split_file = split_file
         self.pollinterval = pollinterval
+        self.histmax = histmax
         self.loop = LoopingCall(self.checkp4)
 
     def startService(self):
@@ -121,11 +121,7 @@
             args.extend(['-u', self.p4user])
         if self.p4passwd:
             args.extend(['-P', self.p4passwd])
-        args.extend(['changes'])
-        if self.last_change is not None:
-            args.extend(['%s...@%d,now' % (self.p4base, self.last_change+1)])
-        else:
-            args.extend(['-m', '1', '%s...' % (self.p4base,)])
+        args.extend(['changes', '-m', str(self.histmax), self.p4base + '...'])
         env = {}
         return getProcessOutput(self.p4bin, args, env)
 
@@ -137,11 +133,13 @@
             if not line: continue
             m = self.changes_line_re.match(line)
             assert m, "Unexpected 'p4 changes' output: %r" % result
-            num = int(m.group('num'))
+            num = m.group('num')
             if last_change is None:
-                log.msg('P4Poller: starting at change %d' % num)
+                log.msg('P4Poller: starting at change %s' % num)
                 self.last_change = num
                 return []
+            if last_change == num:
+                break
             changelists.append(num)
         changelists.reverse() # oldest first
 
@@ -160,7 +158,7 @@
             args.extend(['-u', self.p4user])
         if self.p4passwd:
             args.extend(['-P', self.p4passwd])
-        args.extend(['describe', '-s', str(num)])
+        args.extend(['describe', '-s', num])
         env = {}
         d = getProcessOutput(self.p4bin, args, env)
         return d





More information about the Commits mailing list