Commit Graph

13 Commits

Author SHA1 Message Date
Yuya Nishihara
cbe21a1cc9 osutil: proxy through util (and platform) modules (API)
See the previous commit for why. Marked as API change since osutil.listdir()
seems widely used in third-party extensions.

The win32mbcs extension is updated to wrap both util. and windows. aliases.
2017-04-26 22:26:28 +09:00
Yuya Nishihara
c11e91f8ff pager: use less as a fallback on Unix
This seems reasonable choice per discussion, and the default-default of Git.
See also the inline-comment for why.

https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/097042.html
2017-04-28 20:51:14 +09:00
Pulkit Goyal
24a9271007 py3: replace os.environ with encoding.environ (part 4 of 5) 2016-12-18 02:06:00 +05:30
Pulkit Goyal
851ae37944 py3: replace os.pathsep with pycompat.ospathsep
os.pathsep returns unicode on Python 3. We already have pycompat.ospathsep
which return bytes on Python 3. This patch replaces all the occurrences of
os.pathsep in the codebase (excluding tests) to pycompat.ospathsep.
2016-12-17 19:47:17 +05:30
Yuya Nishihara
d1b623a5c1 scmutil: extend termwidth() to return terminal height, renamed to termsize()
It appears crecord.py has its own termsize() function. I want to get rid of it.

The fallback height is chosen from the default of cmd.exe on Windows, and
VT100 on Unix.
2016-10-20 23:09:05 +09:00
Yuya Nishihara
5b9ee7c321 scmutil: make termwidth() obtain stdio from ui
I'm getting rid of direct sys.stderr|out|in references so Py3 porting will
be slightly easier.
2016-10-20 21:42:11 +09:00
Yuya Nishihara
52e59de51c scmutil: move util.termwidth()
I'm going to get rid of sys.stderr|out|in references from posix.termwidth().
In order to do that, termwidth() needs to take a ui, but functions in util.py
shouldn't depend on a ui object. So moves termwidth() to scmutil.py.
2016-10-20 21:38:44 +09:00
Pulkit Goyal
d280d7dc4a py3: conditionalize _winreg import
_winreg module is renamed to winreg in python 3. Added the conditionalize
statements in the respective file because adding this in pycompat will result
in pycompat throwing error as this is a windows registry module and we have
buildbots and most of the contributors on linux.
2016-08-10 04:35:44 +05:30
Gregory Szorc
2895e45846 scmwindows: use absolute_import 2015-12-21 21:21:09 -08:00
Mads Kiilerich
3772833300 windows: read all global config files, not just the first (issue4491) (BC)
On windows, hgrc.d/*.rc would not be read if mercurial.ini was found. That was
far from obvious from the documentation and different from the behavior on
posix systems.

As a consequence of this, TortoiseHg cacert configuration placed in hgrc.d
would not be read if an old global mercurial.ini still existed.

"hg config -g" could also crash when no global configuration files could be
found.

Instead, make windows behave like posix and read all global configuration
files.

The documentation was in a way right that individual config settings in the
global Mercurial.ini would override settings from for example .hgrc.d\*.rc, but
only because the .d files not would be read at all if a Mercurial.ini was
found. The ordering in the documentation is thus changed to match the code.
2015-10-12 20:13:12 +02:00
Mads Kiilerich
f7a8635451 config: don't read the same config file twice
In some cases some config files would be read twice and shown twice in
showconfig --debug.
2014-09-04 21:36:35 +02:00
Kevin Bullock
66cb0bab34 scmutil: fix NameError on windows
Forgot to import util in mercurial.scmwindows. Error was introduced in:

changeset:   18862:bf7bac95e297
user:        Kevin Bullock <kbullock@ringworld.org>
date:        Tue Feb 12 11:36:21 2013 -0600
summary:     scmutil: split platform-specific bits into their own modules
2013-02-21 13:16:02 -06:00
Kevin Bullock
d24c25031a scmutil: split platform-specific bits into their own modules
This parallels what's done for the util module, which imports either
mercurial.posix or mercurial.windows as 'platform' and then slurps the
appropriate functions into its own namespace.
2013-02-12 11:36:21 -06:00