Capturing stdout with pushbuffer and popbuffer

Alfredo Deza alfredodeza at gmail.com
Fri Feb 26 11:30:30 CST 2010


Hi,

I am trying to catch the output from running *commands.update*, and as per
the API I should call ui.pushbuffer() before the command and ui.poopbuffer()
afterwards.

This is what I am trying:*
**
*

*from mercurial import hg, ui, commands*

*u = ui.ui()*

*u.pushbuffer()*

*r = hg.repository(u, path=".")*
*commands.update(u, r)*

*u.popbuffer()*


But the above returns an empty popbuffer() list, and still pushes the
(correct) info to stdout:

*0 files updated, 0 files merged, 0 files removed, 0 files unresolved*
>

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.

Thanks again for all the help.



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


More information about the Mercurial mailing list