How do I grab the output of a mercurial command ?

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Wed Mar 5 10:54:15 CST 2008


On Wed, Mar 5, 2008 at 4:56 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Wed, Mar 05, 2008 at 04:28:22PM +0100, Donszelmann Mark wrote:
> > Hi
> >
> > this is probably an easy question for a "good" Python/Mercurial
> > programmer. I am not...
> >
> > I execute from a python program the command:
> >
> >       commands.unbundle(self.ui, self.repo, bundle,
> > verbose=self.ui.verbose, quiet=self.ui.quiet)
> >
> > and catch its exceptions. My question is how do I also "catch/grab"
> > the output that this command
> > is writing ("No changesets").
>
> ui.pushbuffer()

But note that should the callee instantiate a child ui, it will
currently not inherit the buffer you set. And you won't get errors,
only output.

See http://article.gmane.org/gmane.comp.version-control.mercurial.devel/15070


More information about the Mercurial mailing list