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