1
2 from twisted.spread import pb
3 from twisted.cred import credentials
4 from twisted.internet import reactor
5
8 self.user = user
9 self.host, self.port = master.split(":")
10 self.port = int(self.port)
11 self.num_changes = 0
12
13 - def send(self, branch, revision, comments, files, user=None, category=None,
14 when=None, properties={}, repository = '', project = ''):
15 if user is None:
16 user = self.user
17 change = {'project': project, 'repository': repository, 'who': user,
18 'files': files, 'comments': comments, 'branch': branch,
19 'revision': revision, 'category': category, 'when': when,
20 'properties': properties}
21 self.num_changes += 1
22
23 f = pb.PBClientFactory()
24 d = f.login(credentials.UsernamePassword("change", "changepw"))
25 reactor.connectTCP(self.host, self.port, f)
26 d.addCallback(self.addChange, change)
27 return d
28
33
35 if self.num_changes > 1:
36 print "%d changes sent successfully" % self.num_changes
37 elif self.num_changes == 1:
38 print "change sent successfully"
39 else:
40 print "no changes to send"
41
43 print "change(s) NOT sent, something went wrong:"
44 print why
45
46 - def stop(self, res):
49
52