Capturing stdout with pushbuffer and popbuffer

Alfredo Deza alfredodeza at gmail.com
Fri Feb 26 13:17:05 CST 2010


On Fri, Feb 26, 2010 at 1:44 PM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:

> On Fri, Feb 26, 2010 at 12:30, Alfredo Deza <alfredodeza at gmail.com> wrote:
> > u = ui.ui()
> > u.pushbuffer()
> > r = hg.repository(u, path=".")
> > commands.update(u, r)
> > u.popbuffer()
>
> Try pushing the buffer of r.ui instead...
>
> Yep, that did it, Let me paste the code so anyone that finds this issue can
see the fix:

u = ui.ui()

r = hg.repository(u, path=".")
r.ui.pushbuffer()

commands.update(u, r)

print r.ui.popbuffer()

It would be really nice to include some small examples (like the above one)
in the API Documentation.

I would not mind doing it my self if I get enough permissions.



> > Can you guys catch what I am doing wrong? I spend a good chunk of time
> > yesterday looking for examples but most of the ones that I found were not
> > very helpful.
>
> This is a little annoying. I'd say that maybe we should inherit the
> buffer if we copy the UI?
>
> Cheers,
>
> Dirkjan
>



-- 
Alfredo Deza
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20100226/8fc36d2b/attachment.htm>


More information about the Mercurial mailing list