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