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