[Buildbot-commits] [Buildbot] #1758: hgbuildbot.py should always use ui.status and ui.warn for output

Buildbot nobody at buildbot.net
Mon Jan 10 21:32:46 UTC 2011


#1758: hgbuildbot.py should always use ui.status and ui.warn for output
------------------------+--------------------
Reporter:  mjw          |       Owner:  mjw
    Type:  enhancement  |      Status:  new
Priority:  major        |   Milestone:  0.8.4
 Version:  0.8.3p1      |  Resolution:
Keywords:  hg           |
------------------------+--------------------

Comment (by mjw):

 So more something like the following?

 {{{
 #!patch
 diff --git a/master/buildbot/changes/hgbuildbot.py
 b/master/buildbot/changes/hgb
 index 86173ca..1f7db8a 100644
 --- a/master/buildbot/changes/hgbuildbot.py
 +++ b/master/buildbot/changes/hgbuildbot.py
 @@ -153,7 +153,13 @@ def hook(ui, repo, hooktype, node=None, source=None,
 **kwar
          }
          d.addCallback(_send, change)

 -    d.addCallbacks(s.printSuccess, s.printFailure)
 +    def _printSuccess(res):
 +        ui.status(s.getSuccessString())
 +
 +    def _printFailure(why):
 +        ui.warn(s.getFailureString())
 +
 +    d.addCallbacks(_printSuccess, _printFailure)
      d.addBoth(s.stop)
      s.run()

 diff --git a/master/buildbot/clients/sendchange.py
 b/master/buildbot/clients/sen
 index b66687b..7024438 100644
 --- a/master/buildbot/clients/sendchange.py
 +++ b/master/buildbot/clients/sendchange.py
 @@ -14,6 +14,7 @@
  # Copyright Buildbot Team Members


 +import sys
  from twisted.spread import pb
  from twisted.cred import credentials
  from twisted.internet import reactor
 @@ -45,16 +46,21 @@ class Sender:
          return d

      def printSuccess(self, res):
 +        print getSuccessString(res)
 +
 +    def getSuccessString(self, res):
          if self.num_changes > 1:
 -            print "%d changes sent successfully" % self.num_changes
 +            return "%d changes sent successfully" % self.num_changes
          elif self.num_changes == 1:
 -            print "change sent successfully"
 +            return "change sent successfully"
          else:
 -            print "no changes to send"
 +            return "no changes to send"

      def printFailure(self, why):
 -        print "change(s) NOT sent, something went wrong:"
 -        print why
 +        print getFailureString(why)
 +
 +    def getFailureString(self, why):
 +        return "change(s) NOT sent, something went wrong: " + str(why)

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

-- 
Ticket URL: <http://trac.buildbot.net/ticket/1758#comment:3>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list