Commit Graph

21 Commits

Author SHA1 Message Date
Matt Harbison
f5febb58c9 tests: print Unix style paths in *.py tests
These tests don't support (glob).  I didn't audit all tests, but these ones were
failing.
2017-04-09 22:19:27 -04:00
Martijn Pieters
0344aed188 config: honour the trusted flag in ui.configbytes 2017-03-12 11:43:31 -07:00
Yuya Nishihara
1d44bd2bbb ui: factor out ui.load() to create a ui without loading configs (API)
This allows us to write doctests depending on a ui object, but not on global
configs.

ui.load() is a class method so we can do wsgiui.load(). All ui() calls but
for doctests are replaced with ui.load(). Some of them could be changed to
not load configs later.
2016-10-22 14:35:10 +09:00
Pulkit Goyal
da7d2d2b5d tests: make test-trusted use print_function
There was some confusing output format at some places in
test-trusted.py.out, the new print function ends with a newline by
default whereas the old print statement uses a space generally. So the
output in test-trusted.py.out is changed because of some confusing
output format which was produced by print statement
2016-04-16 04:06:24 +05:30
Pulkit Goyal
05677e56ec tests: make test-trusted use absolute_import 2016-04-14 00:49:58 +05:30
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02: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
0625b02fef error: update test-trusted.py 2010-06-04 23:00:22 -05:00
Martin Geisler
cac71647b1 posix: do not use fstat in isowner
The fstat function was undefined, but never used since a stat object
was always passed in the optional st argument. Passing st is now
mandatory.

This bug crept in when util was split up into posix and windows
modules. The fstat function is still defined in util, but importing it
into posix would create an import cycle which seems unnecessary.
2009-05-30 23:42:35 +02:00
Matt Mackall
be7d59ab85 ui: kill most users of parentui name and arg, replace with .copy() 2009-04-26 16:50:43 -05:00
Matt Mackall
e8b3de6bf8 ui: introduce new config parser 2009-04-23 15:40:10 -05:00
Matt Mackall
371257fd73 ui: fold readsections into readconfig
readconfig now reads only single files
readconfig takes an optional list of sections
readconfig trusts files we're looking for sections in
2009-04-23 15:40:10 -05:00
Matt Mackall
ebffe5ccb8 ui: refactor option setting
No more passing options as constructor keywords. Basic options are now
always stored in the overlay for simplicity and consistency.
2009-04-23 15:40:10 -05:00
Alexis S. L. Carvalho
cde5fb5024 tests/*: avoid losing the original settings from $HGRCPATH 2007-11-09 20:21:35 -02:00
Thomas Arendsen Hein
49220695bc Removed trailing whitespace and tabs from python files 2007-06-06 20:22:52 +02:00
Thomas Arendsen Hein
a93551d740 Unified #! paths for python scripts and removed them for test modules. 2007-03-01 22:15:17 +01: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
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