[Buildbot-commits] buildbot/buildbot/clients sendchange.py, 1.4, 1.5

Brian Warner warner at users.sourceforge.net
Thu Jan 18 01:24:12 UTC 2007


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

Modified Files:
	sendchange.py 
Log Message:
[project @ darcs_buildbot.py: enhance to handle multiple patches in a single push. Fixes SF#1534049]

Original author: warner at lothar.com
Date: 2007-01-17 23:59:03

Index: sendchange.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/clients/sendchange.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sendchange.py	6 Sep 2006 00:41:55 -0000	1.4
+++ sendchange.py	18 Jan 2007 01:24:10 -0000	1.5
@@ -4,14 +4,18 @@
 from twisted.internet import reactor
 
 class Sender:
-    def __init__(self, master, user):
+    def __init__(self, master, user=None):
         self.user = user
         self.host, self.port = master.split(":")
         self.port = int(self.port)
+        self.num_changes = 0
 
-    def send(self, branch, revision, comments, files):
-        change = {'who': self.user, 'files': files, 'comments': comments,
+    def send(self, branch, revision, comments, files, user=None):
+        if user is None:
+            user = self.user
+        change = {'who': user, 'files': files, 'comments': comments,
                   'branch': branch, 'revision': revision}
+        self.num_changes += 1
 
         f = pb.PBClientFactory()
         d = f.login(credentials.UsernamePassword("change", "changepw"))
@@ -25,9 +29,15 @@
         return d
 
     def printSuccess(self, res):
-        print "change sent successfully"
+        if self.num_changes > 1:
+            print "%d changes sent successfully" % self.num_changes
+        elif self.num_changes == 1:
+            print "change sent successfully"
+        else:
+            print "no changes to send"
+
     def printFailure(self, why):
-        print "change NOT sent"
+        print "change(s) NOT sent, something went wrong:"
         print why
 
     def stop(self, res):





More information about the Commits mailing list