[PATCH 1 of 3] progress: move from extension to core

Matt Mackall mpm at selenic.com
Fri May 18 18:01:11 CDT 2012


On Fri, 2012-05-18 at 16:49 -0500, Augie Fackler wrote:
> On May 18, 2012, at 4:39 PM, Matt Mackall wrote:
> 
> > On Sat, 2012-05-12 at 20:09 +0200, Martin Geisler wrote:
> >> # HG changeset patch
> >> # User Martin Geisler <martin at geisler.net>
> >> # Date 1336829943 -7200
> >> # Node ID 136fc47bfbafb39a599937974d05aaa345ed79a9
> >> # Parent  654b9e1966f76d38b11fbd1d518efce5d58caa88
> >> progress: move from extension to core
> > 
> >>         self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
> >>         self.repo.ui.setconfig('ui', 'interactive', 'off')
> >> +        self.repo.ui.setconfig('progress', 'disable', True)
> > 
> > Huh. Seems we should instead teach progress to respect ui.interactive?
> 
> I thought so too, but the tortoise folks disagreed for some reason IIRC.

Hmm, that's probably this thread:

 http://mercurial.markmail.org/thread/znfnlbnfzk4rorik

But as I read it, their point is that under Tortoise, isatty() == True,
so ui.interactive() == True. So if we teach progress to respect
ui.interactive(), that won't interfere with Tortoise.

On the other hand, ui.interactive() says:

        This function refers to input only; for output, see `ui.formatted()'.   

And ui.formatted()/[ui]formatted disables color, paging, etc., if
sys.stdout is not a tty. But we don't have any predicate/setting that
deals with whether stderr goes to a tty, which is what progress cares
about.

But really, what I want is a way for hgweb to say "don't cook my I/O,
thanks, I'm not a command line tool" without it having to have awareness
of things like progress/pager/color/readline/etc. And that should just
be one setting that overrides all the others.

Probably the way to do that is to wrap all the util.isatty() calls with
a ui.isatty() that respects an internal setting like ui.raw.

Btw, I'm not sure what the use case for progress.assume-tty is, you
snuck it in here:

 http://www.selenic.com/hg/diff/ca6ba6cac6cd/hgext/progress.py

...and that will be extra-hard for hgweb to defeat.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list