[PATCH] hook: write hook output to ui fout descriptor

Idan Kamara idankk86 at gmail.com
Tue Jun 21 08:56:01 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1308664521 -10800
# Branch stable
# Node ID 5a6da6da1faa1329a3938fcb11353cdc948b04c7
# Parent  848a6658069eb88a920ac3ec1220c0c53fae9d0e
hook: write hook output to ui fout descriptor

output on stderr will also be written to ui.fout, unless sys.__stdout__
is passed in (see util.system), thus not changing previous behavior.

This fixes a bug where hooks run through the command server would mess up
with the command protocol, sending non-channeled data to the client.

diff -r 848a6658069e -r 5a6da6da1faa mercurial/hook.py
--- a/mercurial/hook.py	Sun Jun 19 22:33:25 2011 -0400
+++ b/mercurial/hook.py	Tue Jun 21 16:55:21 2011 +0300
@@ -107,7 +107,7 @@
     if 'HG_URL' in env and env['HG_URL'].startswith('remote:http'):
         r = util.system(cmd, environ=env, cwd=cwd, out=ui)
     else:
-        r = util.system(cmd, environ=env, cwd=cwd)
+        r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout)
     if r:
         desc, r = util.explainexit(r)
         if throw:


More information about the Mercurial-devel mailing list