[PATCH] diffstat: use ui.plain() instead of ui.interactive()
Matt Mackall
mpm at selenic.com
Thu Apr 15 17:54:26 CDT 2010
On Thu, 2010-04-15 at 21:47 +0200, Dan Villiom Podlaski Christiansen
wrote:
> On 15 Apr 2010, at 21:33, Augie Fackler wrote:
>
> > On Thu, Apr 15, 2010 at 2:14 PM, Dan Villiom Podlaski Christiansen
> > <danchr at gmail.com> wrote:
> >> On 15 Apr 2010, at 21:00, Alexander Solovyov wrote:
> >>
> >>> On 2010-04-15, Dan Villiom Podlaski Christiansen wrote:
> >>>
> >>>> - width = ui.interactive() and util.termwidth() or 80
> >>>> + if not ui.plain():
> >>>> + width = util.termwidth()
> >>>> + else:
> >>>> + width = 80
> >>>
> >>> Hm, why not just change ui.interactive() to ui.plain()? :-)
> >>
> >> I believe the two serve quite different purposes:
> >> - non-interactive means precisely that; the session can't request input from the user.
> >> - plain means that some customisation has been disabled, and is designed for use in scripts.
> >>
> >> I don't know whether plain currently implies non-interactive. However, most use of the plain mode is likely to be non-interactive too.
> >
> > He meant your diff could be:
> > - width = ui.interactive() and util.termwidth() or 80
> > + width = ui.plain() and util.termwidth() or 80
> >
> > Seems better to me.
>
> Oh, sorry :) Although the two are equivalent, I personally find a full
> if-statement more readable. It's not something I feel strong about,
> though… Should I resend with that change?
No thanks. I'm not really a fan of the "and or" trick these days.
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list