[PATCH 3 of 5] filemerge: use ui out descriptor when calling util.system

Matt Mackall mpm at selenic.com
Wed Jul 6 21:11:21 UTC 2011


On Wed, 2011-07-06 at 22:07 +0200, Adrian Buehlmann wrote:
> On 2011-06-24 18:32, Idan Kamara wrote:
> > # HG changeset patch
> > # User Idan Kamara <idankk86 at gmail.com>
> > # Date 1308924277 -10800
> > # Branch stable
> > # Node ID b520494ed49cdd89a71332a4f6150d1b49578779
> > # Parent  1ec2d22770654b205d1c98e9e8dd1965c6d05263
> > filemerge: use ui out descriptor when calling util.system
> > 
> > diff -r 1ec2d2277065 -r b520494ed49c mercurial/filemerge.py
> > --- a/mercurial/filemerge.py	Fri Jun 24 17:04:37 2011 +0300
> > +++ b/mercurial/filemerge.py	Fri Jun 24 17:04:37 2011 +0300
> > @@ -233,7 +233,8 @@
> >          replace = dict(local=a, base=b, other=c, output=out)
> >          args = util.interpolate(r'\$', replace, args,
> >                                  lambda s: '"%s"' % util.localpath(s))
> > -        r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
> > +        r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
> > +                        out=ui.fout)
> >  
> >      if not r and (_toolbool(ui, tool, "checkconflicts") or
> >                    'conflicts' in _toollist(ui, tool, "check")):
> 
> Could someone explain to me why we need to call the merge tool with out
> set to ui.fout?
> 
> Do we even care about the output of the merge tool? If yes, why?

There are two concerns:

a) ANYTHING writing to sys.stdout directly will corrupt the command
server protocol stream. That's not good.

b) We want to capture EVERYTHING normally written to stdout, whether it
be by hg itself, a merge tool, a hook, or whatever, so we can deliver it
to clients as per the protocol specification.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial-devel mailing list