Commit Graph

277 Commits

Author SHA1 Message Date
Simon Heimberg
28de693a93 ui: fix error, base can not be a list 2011-07-23 06:08:49 +02:00
Matt Mackall
d056d98ad8 ui: rename _is_trusted to _trusted
is and do are pointless, underbar separators are style violations
2011-07-12 16:36:22 -05:00
Idan Kamara
fce499faf1 ui: use ui out descriptor when calling util.system 2011-06-24 17:04:37 +03:00
David Soria Parra
881ac28f17 i18n: remove translation of debug messages 2011-06-21 18:35:13 +02:00
Idan Kamara
325f77da0a ui: use I/O descriptors internally
and as a result:
- fix webproto to redirect the ui descriptors instead of sys.stdout/err
- fix sshserver to use the ui descriptors
2011-06-08 01:39:20 +03:00
Idan Kamara
d3e4ddd52a ui: add I/O descriptors 2011-06-07 13:39:09 +03:00
Idan Kamara
02f21a70dc util: add helper function isatty(fd) to check for tty-ness 2011-06-02 00:43:34 +03:00
Yann E. MORIN
236f8c6745 ui: enable alias exception when reading config in plain mode
When in plain mode with "alias" present in the exception list,
keep the aliases. This will be used later to enable auto-completion.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-17 00:17:52 +02:00
Yann E. MORIN
013aed8037 ui: test plain mode against exceptions
Let ui.plain() accept an optional parameter in the form of a feature
name (as a string) to exclude from plain mode.

The result of ui.plain is now:
 - False if HGPLAIN is not set or the requested feature is in HGPLAINEXCEPT
 - True otherwise

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-17 00:08:51 +02:00
Sune Foldager
73c8696ab4 ui: add configint function and tests 2011-05-03 22:28:08 +02:00
Brodie Rao
b7f0d2a103 url: move URL parsing functions into util to improve startup time
The introduction of the new URL parsing code has created a startup
time regression. This is mainly due to the use of url.hasscheme() in
the ui class. It ends up importing many libraries that the url module
requires.

This fix helps marginally, but if we can get rid of the urllib import
in the URL parser all together, startup time will go back to normal.

perfstartup time before the URL refactoring (707e4b1e8064):

! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

current startup time (9ad1dce9e7f4):

! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

after this change:

! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
2011-04-30 09:43:20 -07:00
Adrian Buehlmann
9a67b02dba move rcpath from util to scmutil 2011-04-21 20:14:29 +02:00
Brodie Rao
5f24d65643 HGPLAIN: allow exceptions to plain mode, like i18n, via HGPLAINEXCEPT
This makes it possible to gain the benefits of HGPLAIN for scripting
while preserving different behaviors like internationalization.
2011-01-05 00:18:36 +11:00
Matt Mackall
d0ca936e58 url: nuke some newly-introduced underbars in identifiers 2011-03-31 10:43:53 -05:00
Brodie Rao
8f5f4f569c url: use url.url in ui.expandpath() 2011-03-30 20:02:17 -07:00
Martin Geisler
73d96c7696 ui: label prompts, default to yellow prompts 2011-03-27 12:59:25 +02:00
Martin Geisler
583f21144f ui: yield unchanged values in walkconfig
Ever since walkconfig was introduced back in 4cc9ef8cd232, the values
yielded has been mutated by replacing "\n" with "\\n". This makes
walkconfig less useful than it could and there is no other way to
iterate over all config sections.

The third-party reposettings extension used ui.walkconfig but did not
take the replacement into account -- this change will actually fix a
bug in the extension when a value contains a newline.
2011-03-10 16:49:37 +01:00
Ry4an Brase
c7fa18ccc0 ui: always report untrusted hgrc files when debug enabled
It was suggested in IRC that people disabling the reporting of unstructed hgrc
files can masquerade as problems.  This makes sure untrusted hgrc files are
always reported if --debug is used.
2011-02-25 23:26:24 -06:00
Matt Mackall
2a8c2e15b4 ui: add configpath helper 2011-01-06 17:04:33 -06:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Nicolas Dumazet
d31f4fef82 ui: only fix config if the relevant section has changed
In particular, when extensions add hooks, or add non-ui and non-paths
configuration items during their setups, we really have no reason
to re-"fix" the config dictionaries.
2010-10-18 14:10:36 +09:00
Augie Fackler
42c8b2cf07 termwidth: move to ui.ui from util 2010-10-10 10:06:36 -05:00
Benoit Boissinot
e73a57d28e fix indentation error 2010-10-09 15:00:30 -05:00
Benoit Boissinot
e5538ef2cc ui.paths: expand paths directly in fixconfig (issue2373)
var and home expansion should be done first.
2010-10-09 12:28:16 -05:00
Augie Fackler
cb7412977d parsebool: create new function and use it for config parsing 2010-08-28 21:50:35 -05:00
Matt Mackall
2fdba01a23 ui: add logging hook 2010-08-19 11:14:02 -05:00
Matt Mackall
eef168b604 merge with stable 2010-08-19 10:25:41 -05:00
Mads Kiilerich
b27d1fd3b8 mq: don't inherit default and default-push paths with --mq (issue2333)
Configuration from the outer repo is inherited to the patches repo when --mq is
used.

In case the patches repo only has paths.default configured but the outer repo
has paths.default-push then the inherited default-push will win. Very
confusing.

Inheriting the default paths is however wrong in all sane cases, so now we
explicitly remove them.
2010-08-18 02:43:45 +02:00
Alecs King
3065ca2943 ui: differentiate empty configlist from None 2010-08-11 20:28:39 +08:00
Martin Geisler
8f362a460f mark ui.warn strings for translation 2010-07-16 14:44:30 +02:00
Mads Kiilerich
8670b69488 ui: ignore EIO in write_err
Hgs signal handler will catch the signal for example if the terminal hg is
running in is closed. That will make it try to warn that it was 'killed', but
that might fail with EIO and cause hg to exit with an unhandled exception.
Normally nobody cares, but system error handlers such as Fedoras abrt will
notice and report https://bugzilla.redhat.com/show_bug.cgi?id=596594 .
2010-06-16 00:22:10 +02:00
Dan Villiom Podlaski Christiansen
6d2a041cb0 ui: document the formatted(), interactive() & plain() functions. 2010-06-07 16:14:12 +02:00
Dan Villiom Podlaski Christiansen
a15c6a0d68 ui: add ui.formatted configuration variable and accessor function.
This new configuration variable is similar in nature `ui.interactive',
but applying to output instead of input. This allows as to support
non-interactive sessions where formatted should be enabled, such as
when using the pager extension.

The variable itself is left undocumented; it is not intended for use
outside Mercurial and its extensions.
2010-06-07 14:59:52 +02:00
Steve Borho
0d0e614fc9 Merge backout 2010-06-08 15:52:56 -05:00
Steve Borho
b82bd4f289 Backed out changeset: 1bfde817782c 2010-06-08 15:52:41 -05:00
Thomas Arendsen Hein
56a5e9e864 ui: handle leading newlines/spaces/commas in configlist
Thanks to Greg Ward for spotting the problem introduced in cc0423a3b3fe
and for supplying the test case.
2010-06-08 21:09:41 +02:00
Steve Borho
e91613380a color: labeled text should be passed to ui.write() as ui.labeled
Some implementations of ui.label() (HTML versions in particular) must escape
the provided text and then markup the text with their tags.  When this marked
up text is then passed to ui.write(), we must label the text as 'ui.labeled'
so the implementation knows not to escape it a second time (exposing the initial
markup).

This required the addition of a 'ui.plain' label for text that is purposefully
not marked up.

I was a little pedantic here, passing even ' ' strings to ui.label() when it
would be included with other labeled text in a ui.write() call.   But it seemed
appropriate to lean to the side of caution.
2010-06-03 23:18:18 -05:00
Chad Dombrova
8cc38b5dd4 ui.username(): expand environment variables in username configuration value.
note: expansion of config variables must be handled on a case-by-case basis
because they can contain arbitrary data that may not be desirable to expand.
2010-05-26 14:03:29 -07:00
Henrik Stuart
bd56afc915 ui: fix check-code error 2010-04-28 21:00:07 +02:00
Henrik Stuart
1c5ca1f5d8 ui: support quotes in configlist (issue2147)
Several places that use ui.configlist, predominantly in authentication
scenarios need to interface with systems that can contain spaces in usernames
(e.g. when client certificates are usernames, or Windows usernames).

This changeset introduces a parser that supports quoting of strings, and
escape quotation marks that get decoded into a single quotation mark that
adopts the usual behavior one would expect from quoting strings. The Python
library shlex module is not used, on purpose, as that raises if it cannot
match quotation marks in the given input.
2010-04-25 17:38:41 +02: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
Yuya Nishihara
56bfdbef10 ui: ignore ui.logtemplate and ui.style when HGPLAIN is set
HGPLAIN should suppress them because they change Mercurial's default
output.
2010-03-03 00:12:05 +09:00
Brodie Rao
df04f13391 ui: unset ui.slash when HGPLAIN is set 2010-02-18 16:51:39 -05:00
Brodie Rao
9dbf7b06a9 ui: suppress aliases when HGPLAIN is set 2010-02-18 16:50:49 -05:00
Brodie Rao
48b845981a ui: add HGPLAIN environment variable for easier scripting
If HGPLAIN is set, the following settings are ignored when read from
hgrc files:

- ui.debug
- ui.fallbackencoding
- ui.quiet
- ui.traceback
- ui.verbose
- defaults.*

Localization is also disabled.

Equivalent options set via command line are honored.
2010-02-07 14:56:18 +01:00
Benoit Boissinot
5919c97831 merge with crew 2010-02-12 16:04:00 +01:00
Thomas Arendsen Hein
4ee8391b45 ui: look before you leap on sys.stderr.closed (and look nicer)
4262f8a58f24 introduced a fix if sys.stdout.closed does not exist.

This change uses a getattr with default instead of hasattr (which just calls
getattr) and accessing the attribute.

Additionally it applies the same fix for sys.stderr.closed as this is not
available in the bpython shell (reported by Roger Gammans).
2010-02-12 15:46:48 +01:00
Augie Fackler
596e0f49d1 ui.progress: clarify termination requirement 2010-02-07 10:25:18 -06:00
Dirkjan Ochtman
09ba0e50af ui: look before you leap on sys.stdout.closed 2010-02-07 16:44:55 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00