[Python-checkins] hooks: Save stdout before calling buildbot's integrated client script

local-hg python-checkins at python.org
Mon Jul 4 21:25:48 CEST 2011


http://hg.python.org/hooks/rev/fa3dd53cde8f
changeset:   73:fa3dd53cde8f
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Mon Jul 04 21:25:47 2011 +0200
summary:
  Save stdout before calling buildbot's integrated client script
(attempting to fix a failure on push)

files:
  hgbuildbot.py |  17 +++++++++++++----
  1 files changed, 13 insertions(+), 4 deletions(-)


diff --git a/hgbuildbot.py b/hgbuildbot.py
--- a/hgbuildbot.py
+++ b/hgbuildbot.py
@@ -20,6 +20,7 @@
 
 import os
 import sys
+from cStringIO import StringIO
 
 from mercurial.i18n import gettext as _
 from mercurial.node import bin, hex, nullid
@@ -110,8 +111,16 @@
             'files': files,
             'branch': branch,
         })
- 
-    for master in masters:
-        sendchanges(master, changes)
-    reactor.run()
 
+    old_stdout = sys.stdout
+    new_stdout = sys.stdout = StringIO()
+    try:
+        for master in masters:
+            sendchanges(master, changes)
+        reactor.run()
+    finally:
+        sys.stdout = old_stdout
+        new_stdout.seek(0)
+        for s in new_stdout:
+            ui.status(s)
+

-- 
Repository URL: http://hg.python.org/hooks


More information about the Python-checkins mailing list