Commit Graph

309 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
2de8c4416b i18n: show the non-ASCII password prompt text correctly
Before this patch, the prompt text for asking password is directly
passed to "getpass.getpass()" of Python standard library.

In "getpass.getpass()" implementation on Windows environment, the
prompt text is split into byte sequence and "msvcrt.putch()" is
applied on each bytes in it. This splitting causes non-ASCII prompt
text to be broken.

This patch shows the prompt text for asking password on "ui.getpass()"
side, and invokes "getpass.getpass()" with empty prompt text. This
prevents non-ASCII prompt text from being broken in
"getpass.getpass()" implementation.

This patch also sets "ui.prompt" label to prompt text to follow
"ui.prompt()" style.
2013-04-25 20:48:49 +09:00
Bryan O'Sullivan
12ef7ce995 ui: add a configbytes method, for space configuration
This accepts a floating point number, followed by optional whitespace,
followed by an optional one- or two-letter unit specifier (for
bytes, kilobytes, megabytes, or gigabytes).
2013-04-18 12:58:28 -07:00
Matt Harbison
7f63ccb02c ui: add 'force' parameter to traceback() to override the current print setting
This will allow a current traceback.print_exc() call in dispatch to be replaced
with ui.traceback() even if --traceback was not given on the command line.
2013-02-09 14:22:52 -05:00
Matt Harbison
8ab43e8c5a ui: add support for fully printing chained exception stacks in ui.traceback()
Currently, only SubrepoAbort has a cause chained to it.
2013-02-09 14:15:34 -05:00
Durham Goode
4add84adea blackbox: adds a blackbox extension
Adds a blackbox extension that listens to ui.log() and writes the messages to
.hg/blackbox.log. Future commits will use ui.log() to log commands, unhandled
exceptions, incoming changes, and hooks.  The extension defaults to logging
everything, but can be configured via blackbox.track to only log certain events.
Log lines are of the format:  "date time user> message"

Example log line:
2013/02/09 08:35:19 durham> 1 incoming changes - new heads: d84ced58aaa
2013-02-12 14:08:33 -08:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Matt Mackall
61aa1f42b8 merge with stable 2012-06-29 00:40:52 -05:00
Idan Kamara
7875dccb0b ui: add a variable to control whether hooks should be called
So hooks can be temporarily disabled.
2012-06-23 19:57:07 +03:00
Martin Geisler
2fb6d24292 ui: lowercase "no username" warning 2012-06-12 14:18:18 +02:00
Martin Geisler
85338c4193 ui: lowercase "not trusting file" warning message 2012-06-12 14:18:18 +02:00
Martin Geisler
d599cd6742 ui: lowercase ConfigError warning message 2012-06-12 14:18:18 +02:00
Matt Mackall
b267442ddb ui: add _isatty method to easily disable cooked I/O 2012-05-20 14:31:56 -05:00
Brodie Rao
46ce54af4d cleanup: replace more naked excepts with more specific ones 2012-05-13 13:17:31 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Steven Stallion
d79ff306e5 plan9: initial support for plan 9 from bell labs
This patch contains support for Plan 9 from Bell Labs. A README is
provided in contrib/plan9 which describes the port in greater detail.
A new extension is also provided named factotum which permits the
factotum(4) authentication agent to provide credentials for HTTP
repositories. This extension is also applicable to other POSIX
platforms which make use of Plan 9 from User Space (aka plan9ports).
2012-04-08 12:43:41 -07:00
Matt Mackall
560dd93d34 merge with stable 2012-04-06 15:18:14 -05:00
Kevin Bullock
cb270596b4 ui: swallow EBADF on stderr
ui.write_err already swallows EPIPE and EIO if a write to stderr fails.
On Mac OS X at least, a write to a closed file descriptor results in
EBADF. Before this patch, hg would exit with status 1 if a write to
stderr failed during startup (e.g. while trying to print a warning about
not finding an extension):

  $ ./hg --config extensions.foo= version 2>&-; echo $?
  1

With this patch, it correctly swallows stderr and continues to run the
command:

  $ ./hg --config extensions.foo= version 2>&-
  Mercurial Distributed SCM (version 2.1)
  ...
2012-04-04 12:46:54 -05:00
Matt Mackall
107150b868 ui: add formatter method 2012-02-20 16:42:48 -06:00
Pierre-Yves David
3dfd3d6ee3 config: have a way to backup and restore value in config
This is introduce to allow temporary overwriting of a config value while being
able to reinstall the old value once done. The main advantage over using
``config`` and ``setconfig`` is that backup and restore will properly restore
the lack of any config. Restoring the fact that there was no value is important
to allow config user to keep using meaniful default value.

A more naive approach will result in the following scenario::

  Before:
    config(section, item, my_default) --> my_default

  temporal overwrite
    old = config(section, item)
    …
    setconfig(section, item, old)

  After
    config(section, item, my_default) --> None

The first user of this feature should be mq to overwriting minimal phase of
future commit.
2012-01-18 16:52:26 +01:00
Matt Mackall
864ce9da04 misc: adding missing file close() calls
Spotted by Victor Stinner <victor.stinner@haypocalc.com>
2011-11-03 11:24:55 -05:00
Matt Mackall
af293bcf51 merge with stable 2011-09-12 23:02:45 -05:00
Simon Heimberg
4cccc99bac ui: write traceback to self.ferr 2011-09-11 14:42:30 +02:00
Martin Geisler
9b3666843e ui: also swap sys.stdout with self.fout in _readline
In 55a66b5d9114, _readline was changed to output a space using
raw_input and this was done using sys.stdout directly, not self.fout.

This change broke the command server for JavaHg since it (and other
clients) would see a spurious ' ' on stdout and interpret this as an
unknown channel.
2011-08-30 14:18:58 +02:00
Idan Kamara
9b89917a5f ui: pass ' ' to raw_input when prompting
This is a workaround for calling ui.prompt(...), typing some character then
hitting backspace which causes the entire line to delete rather than just the
one character. This was seen on Debian using gnome-terminal.

(credits to Mads for the idea)

Python bug can be found here: http://bugs.python.org/issue12833
2011-08-25 22:06:03 +03:00
Idan Kamara
bc85c198e4 ui: call write() so the prompt string goes through subclassed implementation 2011-08-01 19:53:00 +03:00
Martin Geisler
0bbf634d5b merge with stable 2011-08-30 15:22:10 +02:00
Matt Mackall
afa4ceeda8 merge with stable 2011-08-25 16:21:53 -05:00
Matt Mackall
eebe42565e ui: allow alternatives for config options 2011-08-11 14:34:03 -05:00
Matt Mackall
eb714d4d00 merge with stable 2011-08-01 14:52:11 -05:00
Simon Heimberg
9cc31081c5 ui: config path relative to repo root 2011-07-23 06:09:14 +02:00
Simon Heimberg
e99ca763b9 ui: providing no default value to configpath should not raise an Error 2011-07-23 06:08:52 +02:00
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