[Buildbot-commits] buildbot/buildbot/changes pb.py,1.10,1.11
Brian Warner
warner at users.sourceforge.net
Mon Aug 21 03:38:07 UTC 2006
Update of /cvsroot/buildbot/buildbot/buildbot/changes
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8420/buildbot/changes
Modified Files:
pb.py
Log Message:
[project @ PBChangeSource.prefix= : fix and simplify, just do a string comparison]
This effectively resolves SF#1217699 and SF#1381867
Original author: warner at lothar.com
Date: 2006-08-21 03:36:38
Index: pb.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/pb.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pb.py 15 Nov 2005 08:38:05 -0000 1.10
+++ pb.py 21 Aug 2006 03:38:04 -0000 1.11
@@ -10,13 +10,9 @@
class ChangePerspective(NewCredPerspective):
- def __init__(self, changemaster, prefix, sep="/"):
+ def __init__(self, changemaster, prefix):
self.changemaster = changemaster
self.prefix = prefix
- # this is the separator as used by the VC system, not the local host.
- # If for some reason you're running your CVS repository under
- # windows, you'll need to use a PBChangeSource(sep="\\")
- self.sep = sep
def attached(self, mind):
return self
@@ -26,16 +22,13 @@
def perspective_addChange(self, changedict):
log.msg("perspective_addChange called")
pathnames = []
+ prefixpaths = None
for path in changedict['files']:
if self.prefix:
- bits = path.split(self.sep)
- if bits[0] == self.prefix:
- if bits[1:]:
- path = self.sep.join(bits[1:])
- else:
- path = ''
- else:
- break
+ if not path.startswith(self.prefix):
+ # this file does not start with the prefix, so ignore it
+ continue
+ path = path[len(self.prefix):]
pathnames.append(path)
if pathnames:
@@ -48,10 +41,40 @@
self.changemaster.addChange(change)
class PBChangeSource(base.ChangeSource):
- compare_attrs = ["user", "passwd", "port", "prefix", "sep"]
+ compare_attrs = ["user", "passwd", "port", "prefix"]
def __init__(self, user="change", passwd="changepw", port=None,
- prefix=None, sep="/"):
+ prefix=None, sep=None):
+ """I listen on a TCP port for Changes from 'buildbot sendchange'.
+
+ I am a ChangeSource which will accept Changes from a remote source. I
+ share a TCP listening port with the buildslaves.
+
+ Both the 'buildbot sendchange' command and the
+ contrib/svn_buildbot.py tool know how to send changes to me.
+
+ @type prefix: string (or None)
+ @param prefix: if set, I will ignore any filenames that do not start
+ with this string. Moreover I will remove this string
+ from all filenames before creating the Change object
+ and delivering it to the Schedulers. This is useful
+ for changes coming from version control systems that
+ represent branches as parent directories within the
+ repository (like SVN and Perforce). Use a prefix of
+ 'trunk/' or 'project/branches/foobranch/' to only
+ follow one branch and to get correct tree-relative
+ filenames.
+
+ @param sep: DEPRECATED (with an axe). sep= was removed in
+ buildbot-0.7.4 . Instead of using it, you should use
+ prefix= with a trailing directory separator. This
+ docstring (and the better-than-nothing error message
+ which occurs when you use it) will be removed in 0.7.5 .
+ """
+
+ # sep= was removed in 0.7.4 . This more-helpful-than-nothing error
+ # message will be removed in 0.7.5 .
+ assert sep is None, "prefix= is now a complete string, do not use sep="
# TODO: current limitations
assert user == "change"
assert passwd == "changepw"
@@ -60,7 +83,6 @@
self.passwd = passwd
self.port = port
self.prefix = prefix
- self.sep = sep
def describe(self):
# TODO: when the dispatcher is fixed, report the specific port
@@ -85,5 +107,5 @@
master.dispatcher.unregister(self.user)
def getPerspective(self):
- return ChangePerspective(self.parent, self.prefix, self.sep)
+ return ChangePerspective(self.parent, self.prefix)
More information about the Commits
mailing list