1
2
3 from twisted.python import log
4
5 from buildbot.pbutil import NewCredPerspective
6 from buildbot.changes import base, changes
7
9
10 - def __init__(self, changemaster, prefix):
13
18
20 log.msg("perspective_addChange called")
21 pathnames = []
22 prefixpaths = None
23 for path in changedict['files']:
24 if self.prefix:
25 if not path.startswith(self.prefix):
26
27 continue
28 path = path[len(self.prefix):]
29 pathnames.append(path)
30
31 if pathnames:
32 change = changes.Change(changedict['who'],
33 pathnames,
34 changedict['comments'],
35 branch=changedict.get('branch'),
36 revision=changedict.get('revision'),
37 category=changedict.get('category'),
38 when=changedict.get('when'),
39 )
40 self.changemaster.addChange(change)
41
43 compare_attrs = ["user", "passwd", "port", "prefix"]
44
45 - def __init__(self, user="change", passwd="changepw", port=None,
46 prefix=None, sep=None):
47 """I listen on a TCP port for Changes from 'buildbot sendchange'.
48
49 I am a ChangeSource which will accept Changes from a remote source. I
50 share a TCP listening port with the buildslaves.
51
52 The 'buildbot sendchange' command, the contrib/svn_buildbot.py tool,
53 and the contrib/bzr_buildbot.py tool know how to send changes to me.
54
55 @type prefix: string (or None)
56 @param prefix: if set, I will ignore any filenames that do not start
57 with this string. Moreover I will remove this string
58 from all filenames before creating the Change object
59 and delivering it to the Schedulers. This is useful
60 for changes coming from version control systems that
61 represent branches as parent directories within the
62 repository (like SVN and Perforce). Use a prefix of
63 'trunk/' or 'project/branches/foobranch/' to only
64 follow one branch and to get correct tree-relative
65 filenames.
66
67 @param sep: DEPRECATED (with an axe). sep= was removed in
68 buildbot-0.7.4 . Instead of using it, you should use
69 prefix= with a trailing directory separator. This
70 docstring (and the better-than-nothing error message
71 which occurs when you use it) will be removed in 0.7.5 .
72 """
73
74
75
76 assert sep is None, "prefix= is now a complete string, do not use sep="
77
78 assert user == "change"
79 assert passwd == "changepw"
80 assert port == None
81 self.user = user
82 self.passwd = passwd
83 self.port = port
84 self.prefix = prefix
85
87
88
89 d = "PBChangeSource listener on all-purpose slaveport"
90 if self.prefix is not None:
91 d += " (prefix '%s')" % self.prefix
92 return d
93
101
107
110