[PATCH 1 of 3] ui: introduce util.system() wrapper to make sure ui.fout is used

Augie Fackler raf at durin42.com
Mon Nov 10 10:27:30 CST 2014


On Mon, Nov 10, 2014 at 10:57:50PM +0900, Yuya Nishihara wrote:
> On Sat, 08 Nov 2014 15:24:29 +0000, Pierre-Yves David wrote:
> > On 11/08/2014 02:51 PM, Yuya Nishihara wrote:
> > > On Sat, 08 Nov 2014 10:27:47 +0000, Pierre-Yves David wrote:
> > >> On 11/08/2014 05:42 AM, Yuya Nishihara wrote:
> > >>> # HG changeset patch
> > >>> # User Yuya Nishihara <yuya at tcha.org>
> > >>> # Date 1415419062 -32400
> > >>> #      Sat Nov 08 12:57:42 2014 +0900
> > >>> # Node ID d83746a91dc410f60b45916c2e55dadde4238b42
> > >>> # Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
> > >>> ui: introduce util.system() wrapper to make sure ui.fout is used
> > >>
> > >> The idea looks good, but can I get you to add some docstring the new
> > >> method so that people understand its purpose?
> > >
> > > will do.
> > >
> > >> As far as I understand the lack of it makes thg command server usage to
> > >> break in multiple occasion. Should this be target on stable?
> > >
> > > Not for stable. This is just a sugar for util.system(..., out=ui.fout).
> > >
> > > http://markmail.org/message/fwltwdugndmsb3g7
> > >
> > >> Finally, Do we have a plan to force people to use ui.system instead of
> > >> util.system?
> > >
> > > No idea. Should we make "out" be a required parameter as well?
> >
> > How many case is there where util.system should be used over ui.system ?
>
> All util.system() in Mercurial can be replaced by ui.system().
>
> Possible use case of util.system() is
>
>     buf = StringIO()  # or temporary file
>     util.system(..., out=buf)

Does anyone actually do this?

>
> > if not too much, we could maybe more util.system away (rename to
> > rawsystem + add a comment pointing to ui.system?
> >
> > (I'm not saying we must do it. I'm asking how reasonable it would be to
> > do so)
>
> It might break third-party extensions unnecessarily.

I don't think I'd worry about that too much - extension authors know
they're building on quicksand. I don't think shelling out is
super-common in extensions.

>
> Regards,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list