Commit Graph

19 Commits

Author SHA1 Message Date
Brodie Rao
6f58bfc15e color/progress: subclass ui instead of using wrapfunction (issue2096)
This resolves the issue of hg cmd --mq not being colorized. This was due
to color wrapping only the instance of ui passed to dispatch._runcommand(),
which isn't the same ui object that mq.mqcommand() receives. After dispatch
calls extensions.loadall(), it makes sure any changes to ui.__class__ in
uisetup are propagated.

progress is updated to wrap ui in the same manner because wrapfunction
doesn't play well when ui.__class__ has been replaced by another extension
(orig will point to the old class method instead of color's).
2010-07-01 19:23:26 -05:00
Augie Fackler
be26c0a474 progress: check stderr.isatty() before each print
This prevents writing progress information to a non-tty stderr if one is
swapped in after startup, which happens in `hg serve`.
2010-06-27 22:20:47 -05:00
Augie Fackler
8d7cb15f33 progress: fall back to indeterminate progress if position is >= total 2010-04-08 15:04:00 -05:00
Brodie Rao
9a7e3ba689 ui: add ui.write() output labeling API
This adds output labeling support with the following methods:

- ui.write(..., label='topic.name topic2.name2 ...')
- ui.write_err(.., label=...)
- ui.popbuffer(labeled=False)
- ui.label(msg, label)

By adding an API to label output directly, the color extension can forgo
parsing command output and instead override the above methods to insert
ANSI color codes. GUI tools can also override the above methods and use
the labels to do GUI-specific styling.

popbuffer gains a labeled argument that, when set to True, returns its
buffered output with labels handled. In the case of the color extension,
this would return output with color codes embedded. For existing users
that use this method to capture and parse output, labels are discarded
and output returned as normal when labeled is False (the default).

Existing wrappers of ui.write() and ui.write_err() should make sure to
accept its new **opts argument.
2010-04-02 15:22:00 -05:00
Augie Fackler
eeb8822ee1 progress: use stderr instead of stdout; check stderr.isatty()
This means that progress bars will continue to show on the terminal
when both stdin and stdout are redirected.
2010-03-29 16:44:24 -05:00
Augie Fackler
b3f787c2e6 progress: document progress.disable config option 2010-03-11 16:54:34 -06:00
Benoit Boissinot
5b98d49b1f progress: clear progress before writing to stderr 2010-03-06 13:32:14 +01:00
Steve Borho
9309ff3d0c progress: provide an explicit disable method for developers
The other three checks for disabling the progress bar have serious
side effects for any class that derives from ui.ui()
2010-02-23 23:10:01 -06:00
Ronny Pfannschmidt
4e6e8c7c75 make the progress extension honor ui.quiet 2010-02-21 15:26:55 +01:00
Martin Geisler
f60d955070 progress: use inline literals in help string 2010-02-14 17:09:52 +01:00
Patrick Mezard
cdb100ac42 progress: make progress.refresh=0 always display the progress line
This has no effect in real world where progress.refresh in unlikely to be set
to zero, but is very useful in tests where all progress output is to be traced.
It failed on platforms with coarse time.time() granularity, like Windows+py25.
2010-02-14 15:42:47 +01:00
Brodie Rao
892ba5a830 remove unused imports 2010-02-14 01:52:31 -05:00
Patrick Mezard
c4cbe25bb9 progress: make use of progress.refresh 2010-02-14 13:58:30 +01:00
Brodie Rao
3a1961dd4f progress: make determinate bar more like wget progress bar
foo [                                                          ]  0/58
foo [>                                                         ]  1/58
foo [=>                                                        ]  2/58
...
foo [=======================================================>  ] 56/58
foo [========================================================> ] 57/58
foo [=========================================================>] 58/58

The bar now has a '>' character at the end. This indicates the direction,
is consistent with the indeterminate '<=>' bar, and looks much nicer.
2010-02-13 23:34:15 -05:00
Brodie Rao
1b6c146296 progress: simplify spacejoin() 2010-02-13 23:34:20 -05:00
timeless
6562078e97 progress: fix description 2010-02-14 00:46:13 +02:00
Augie Fackler
e22247c3bb progress: only reset state if finishing progress for the current topic
This prevents some visual glitches when doing a clone --pull locally.
2010-02-13 09:49:06 -06:00
Benoit Boissinot
0bb91a20fe progress: correctly handle empty progress topic 2010-02-13 09:55:28 +01:00
Augie Fackler
a30e3bd4a9 Progress bar extension 2010-02-12 21:53:32 -06:00