[PATCH] Issue937: error messages from hooks not sent over HTTP

Dirkjan Ochtman dirkjan at ochtman.nl
Sun Feb 24 15:41:11 CST 2008


Jesse Glick wrote:
> diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
> --- a/mercurial/hgweb/protocol.py
> +++ b/mercurial/hgweb/protocol.py
> @@ -177,7 +177,9 @@ def unbundle(web, req):
>                  # send addchangegroup output to client
>  
>                  old_stdout = sys.stdout
> +                old_stderr = sys.stderr
>                  sys.stdout = cStringIO.StringIO()
> +                sys.stderr = sys.stdout

Nitpicking: maybe you could do it more like this?

oldio = sys.stdout, sys.stderr
sys.stdout = sys.stderr = cstringIO.StringIO()

Or is that just me being anal about lesscode(.org)?

Otherwise, seems like a fine idea, of course. Although maybe we need 
some provisions for exceptions throwing their output in there where the 
client cannot necessarily deal with it first. I think there are some bug 
reports to that effect in the bts (see issue996 for discussion).

Cheers,

Dirkjan



More information about the Mercurial-devel mailing list