[Buildbot-commits] buildbot/buildbot/clients sendchange.py,NONE,1.1

Brian Warner warner at users.sourceforge.net
Wed May 4 02:09:42 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/clients
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31343/buildbot/clients

Added Files:
	sendchange.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-119
Creator:  Brian Warner <warner at monolith.lothar.com>

add 'buildbot sendchange' command

	* buildbot/scripts/runner.py (sendchange): new command to send a
	change to a buildbot.changes.pb.PBChangeSource receiver.
	* buildbot/test/test_changes.py (Sender): test it

	* buildbot/master.py (BuildMaster.startService): mark .readConfig
	after any reading of the config file, not just when we do it in
	startService. This makes some tests a bit cleaner.

	* buildbot/changes/pb.py: add some log messages


--- NEW FILE: sendchange.py ---

from twisted.spread import pb
from twisted.cred import credentials
from twisted.internet import reactor
from twisted.python import log

class Sender:
    def __init__(self, master, user):
        self.user = user
        self.host, self.port = master.split(":")
        self.port = int(self.port)

    def send(self, revision, comments, files):
        change = {'who': self.user, 'files': files, 'comments': comments,
                  'revision': revision}

        f = pb.PBClientFactory()
        d = f.login(credentials.UsernamePassword("change", "changepw"))
        reactor.connectTCP(self.host, self.port, f)
        d.addCallback(lambda remote: remote.callRemote('addChange', change))
        return d

    def printSuccess(self, res):
        print "change sent successfully"
    def printFailure(self, why):
        print "change NOT sent"
        print why

    def stop(self, res):
        reactor.stop()
        return res

    def run(self):
        reactor.run()





More information about the Commits mailing list