Commit Graph

150 Commits

Author SHA1 Message Date
Jesse Glick
b63e70848a Ensure that absolutized paths from hgrc do not contain ../ segments. 2008-01-08 22:40:51 -05:00
Kirill Smelkov
cbdc1f53db prompt: kill matchflags
Python already lets one to embed RE flags directly in a regex, which
is a much nicer way to do things:

(?iLmsux)
        (One or more letters from the set "i", "L", "m", "s", "u", "x".)
        ...

matchflags was introduced in 14a7e862c60f, and the record extension is the only
user. I've killed matchflag, and adjusted record code appropriately.
2007-12-28 00:03:55 -06:00
Matt Mackall
faa2e2041c ui: allow default when prompting 2007-12-27 22:49:01 -06:00
Thomas Arendsen Hein
d02cbcaa88 merge with crew-stable 2007-12-27 13:39:59 +01:00
Thomas Arendsen Hein
0a782ae200 Make ui.prompt repeat on "unrecognized response" again (issue897)
(this was accidentally changed in 18945c2eb022)
2007-12-27 10:32:33 +01:00
Osku Salerma
7f9d71b715 Use VISUAL in addition to EDITOR when choosing the editor to use. 2007-12-05 20:40:01 +09:00
Steve Borho
465647eece workaround for raw_input() on Windows
Since change 0f20f68c768c, Mercurial has set_binary() on stdin, stdout, and stderr.
On Windows, this had the side effect of causing raw_input() to emit trailing carriage
returns on it's returned strings.  This was causing web authentication problems.
2007-12-03 17:28:26 -06:00
Dirkjan Ochtman
7b9cb3b6fc Don't try to determine interactivity if ui() called with interactive=False.
WSGI applications are not supposed to refer to sys.stdin. In af5aceab19f4,
hgweb and hgwebdir were fixed to pass interactive=False to their ui()'s, but
sys.stdin.isatty() was still called by the ui objects. This change makes sure
only the ui.fixconfig() method will call ui.isatty() (by making the
ui._readline() method, which is currently only called from ui.prompt(),
private). ui.fixconfig() is changed to let config files override the initial
interactivity setting, but not check isatty() if interactive=False was
specified in the creation of the ui.
2007-09-25 19:05:34 +02:00
Bryan O'Sullivan
46880a1c4f record: improve docs, improve prompts 2007-08-09 17:29:16 -07:00
Thomas Arendsen Hein
e05f361209 os.isatty isn't available on Windows, so use sys.stdin.isatty() 2007-08-01 10:33:21 +02:00
Bryan O'Sullivan
80c88dabf8 ui: get readline and prompt to behave better depending on interactivity 2007-07-31 16:28:05 -07:00
Thomas Arendsen Hein
c6d47ef08c Catch illegal boolean values in hgrc nicely.
With hg 0.9.3 the section and parameter name wasn't printed,
with hg 0.9.4 there was a traceback for ValueError.
2007-06-26 20:37:15 +02:00
Thomas Arendsen Hein
61d51838df New config option: ui.report_untrusted (defaults to True) 2007-06-25 22:41:15 +02:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Thomas Arendsen Hein
483231d996 Cleanup of whitespace, indentation and line continuation. 2007-06-19 08:06:37 +02:00
Matt Mackall
b99ae11550 dirstate: pull ignore smarts out of ui 2007-06-18 13:24:34 -05:00
Matt Mackall
cdeb6ec2da extensions: kill ui readhooks
Move .hgrc extension loading into localrepo
2007-06-18 13:24:34 -05:00
Matt Mackall
8395ca26f3 extensions: pull extension-aware bits out of ui 2007-06-18 13:24:34 -05:00
Patrick Mezard
a55efff966 ui: make readsections() abort when configuration cannot be read. 2007-06-03 22:11:25 +02:00
Bryan O'Sullivan
ebb57c99be ui: Rename has_config to has_section. 2007-05-27 13:50:59 -07:00
Matt Mackall
04561e556e revlog: simplify revlog version handling
- pass the default version as an attribute on the opener
- eliminate config option mess
2007-03-22 19:52:38 -05:00
Thomas Arendsen Hein
c019d21898 merge with crew-stable 2007-03-14 22:43:57 +01:00
Thomas Arendsen Hein
678e517eae Only hg repositories override [paths], not simple directories (fixes issue510) 2007-03-14 22:38:40 +01:00
Thomas Arendsen Hein
1be2af280f Abort on empty username so specifying a username can be forced.
This behaviour was introduced by d5601ef79d86 and broken by c608116532fe.
Added test for this.
2007-01-24 23:04:51 +01:00
Alexis S. L. Carvalho
6dc09d1834 Fix hg showconfig traceback with values that aren't strings 2007-02-15 10:15:08 -02:00
Thomas Arendsen Hein
f599c21b8e merge with stable 2007-01-24 23:07:09 +01:00
Patrick Mezard
784a42ef92 Flush stderr after write.
stderr can be buffered under win32 when redirected to a file,
including stdout.
2007-01-10 20:35:27 +01:00
Matt Mackall
296d6a7cb8 Simplify i18n imports 2006-12-14 20:25:19 -06:00
Matt Mackall
4492623506 Fix a pygettext complaint 2006-12-14 17:32:25 -06:00
Matt Mackall
4a935821ae Fix a pygettext complaint 2006-12-14 17:32:25 -06:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Matt Mackall
5ee2088301 add a simple nested buffering scheme to ui 2006-12-01 01:28:18 -06:00
Benoit Boissinot
3bad25e752 only print a warning when no username is specified
- revert most of 8b55c0ba
- display the username during interactive commit
2006-11-28 21:16:05 +01:00
Alexis S. L. Carvalho
3508dfb573 Update trusted_users only after we've seen a file not owned by the user 2006-11-18 23:51:15 -02:00
Alexis S. L. Carvalho
6e218edeb5 Avoid looking up usernames if the current user owns the .hgrc file
Converting uids into usernames may be somewhat expensive when NIS
or LDAP is involved.
2006-11-18 23:51:14 -02:00
Alexis S. L. Carvalho
ad6b588b55 Use a variable to explicitly trust global config files 2006-11-18 23:51:13 -02:00
Matt Mackall
0809871d9a ui: remove last vestiges of header buffering 2006-11-15 15:51:58 -06:00
Matt Mackall
b0f86b4331 refactor header handling for changelog formatting 2006-11-13 13:26:57 -06:00
Thomas Arendsen Hein
f26c110d43 Turn of "Not trusting file" logging when running hgweb and hgwebdir
(hg serve still shows the warning)
2006-10-26 19:25:45 +02:00
Alexis S. L. Carvalho
cb59e4de82 save settings from untrusted config files in a separate configparser
This untrusted configparser is a superset of the trusted configparser,
so that interpolation still works.

Also add an "untrusted" argument to ui.config* to allow querying
ui.ucdata.

With --debug, we print a warning when we read an untrusted config
file, and when we try to access a trusted setting that has one value
in the trusted configparser and another in the untrusted configparser.
2006-10-26 19:25:45 +02:00
Alexis S. L. Carvalho
c44cea1532 Only read .hg/hgrc files from trusted users/groups
The list of trusted users and groups is specified in the [trusted]
section of a hgrc; the current user is always trusted; "*" can be
used to trust all users/groups.

Global hgrc files are always read.

On Windows (and other systems that don't have the pwd and grp modules),
all .hg/hgrc files are read.

This is essentially the same patch that was previously applied as
revision f077d29b114d.
2006-10-26 19:25:44 +02:00
Thomas Arendsen Hein
37655ca869 Commit username: Better error message, abort on empty name, fix documentation. 2006-10-23 14:56:51 +02:00
Benoit Boissinot
7c004b60e9 fix errors spotted by pychecker 2006-10-19 16:55:34 +02:00
Benoit Boissinot
dc9483558a makes username mandatory 2006-10-18 22:24:03 +02:00
Alexis S. L. Carvalho
0ef46c9478 add ui.readsections
Given a file name and a set of sections, this function reads the file
and adds only the specified sections to the configuration data.
2006-10-17 16:59:24 -03:00
Alexis S. L. Carvalho
a85d162373 Use a case-sensitive version of SafeConfigParser everywhere
This change has the potential to break existing setups, but the current
behaviour (the keys in configuration files are always lower-cased) can
bite us in a few places:

- no way to use a Command in [defaults]
- hgext.Extension doesn't work in [extensions]
- you can't use an Upper/case/PATH in the [paths] section of hgweb.config
- you can't (easily) protect paths with upper-case letters with the
  acl extension
- you can't specify a /Path/TO/a/rEPO in the [reposubs] section for
  the notify extension
2006-10-16 15:38:53 -03:00
Thomas Arendsen Hein
c923f5a65a Removed unused imports of mdiff and templater from ui.py 2006-10-13 19:35:08 +02:00
Alexis S. L. Carvalho
3eeaf02465 update ui.quiet/verbose/debug/interactive every time the config changes
- ui.quiet/verbose/debug/interactive become just a cache of the ui.cdata
  settings

- the quiet, verbose, debug and interactive options from the [ui] section
  from .hg/hgrc files are respected for commands that open the repo

- setting ui.quiet/verbose/debug/interactive with --config works

- the command line options always override the hgrc settings - previously
  it wasn't possible to override a [ui] debug = True.  --debug still
  takes precedence over --quiet and --verbose.
2006-10-10 18:43:20 -03:00
Alexis S. L. Carvalho
105915ca0d ui.py: untangle updateopts
The code in ui.updateopts that handles ui.quiet, ui.verbose and
ui.debugflag is too smart, making it somewhat hard to see what
are the exact constraints placed on the values of these variables,
hiding some buglets.

This patch makes these constraints more explicit, fixing these
buglets and changing the behaviour slightly.  It also adds a test
to make sure things work as expected in the future.

The buglets:
- setting ui.debug = True in a hgrc wouldn't turn on verbose mode
- additionally, setting ui.quiet = True or using --quiet would give
  you a "quiet debug" mode.

The behaviour change:
- previously, in a hgrc file, ui.quiet wins against ui.verbose (i.e.
  the final result would be quiet mode), but --verbose wins against
  --quiet
- now ui.quiet nullifies ui.verbose and --verbose nullifies --quiet.
  As a consequence, using -qv always gives you normal mode (unless
  debug mode was turned on somewhere)
2006-10-10 18:43:20 -03:00
Alexis S. L. Carvalho
b5be394282 ui.py: normalize settings every time the configuration changes
Previously, we would normalize settings (e.g. turn relative paths into
absolute ones) only after reading a config file.

Now "--config paths.foo=bar" will use the cwd to make "bar" an absolute
path.
2006-10-10 18:43:20 -03:00