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={}):
15 if user is None:
16 user = self.user
17 change = {'who': user, 'files': files, 'comments': comments,
18 'branch': branch, 'revision': revision, 'category': category,
19 'when': when, 'properties': properties}
20 self.num_changes += 1
21
22 f = pb.PBClientFactory()
23 d = f.login(credentials.UsernamePassword("change", "changepw"))
24 reactor.connectTCP(self.host, self.port, f)
25 d.addCallback(self.addChange, change)
26 return d
27
32
34 if self.num_changes > 1:
35 print "%d changes sent successfully" % self.num_changes
36 elif self.num_changes == 1:
37 print "change sent successfully"
38 else:
39 print "no changes to send"
40
42 print "change(s) NOT sent, something went wrong:"
43 print why
44
45 - def stop(self, res):
48
51