1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 from twisted.spread import pb
18 from twisted.cred import credentials
19 from twisted.internet import reactor
20
22 - def __init__(self, master, auth=('change','changepw')):
23 self.username, self.password = auth
24 self.host, self.port = master.split(":")
25 self.port = int(self.port)
26 self.num_changes = 0
27
28 - def send(self, branch, revision, comments, files, who=None, category=None,
29 when=None, properties={}, repository='', project='', revlink=''):
30 change = {'project': project, 'repository': repository, 'who': who,
31 'files': files, 'comments': comments, 'branch': branch,
32 'revision': revision, 'category': category, 'when': when,
33 'properties': properties, 'revlink': revlink}
34 self.num_changes += 1
35
36 f = pb.PBClientFactory()
37 d = f.login(credentials.UsernamePassword(self.username, self.password))
38 reactor.connectTCP(self.host, self.port, f)
39 d.addCallback(self.addChange, change)
40 return d
41
46
48 if self.num_changes > 1:
49 print "%d changes sent successfully" % self.num_changes
50 elif self.num_changes == 1:
51 print "change sent successfully"
52 else:
53 print "no changes to send"
54
56 print "change(s) NOT sent, something went wrong:"
57 print why
58
59 - def stop(self, res):
62
65