debug: move extensions debug behind a dedicated flag
Since
b86664c81833, we process the `--debug` flag earlier. This is overall
good and useful, but has at least one negative side effect.
Previously the debug message we report when trying to import extensions were
issued before we processed the `--debug` flag. Now they happen after.
Before:
$ ./hg id --debug
21f507b8de2f9c1606e9aeb5ec7d2a6dedb7a4a7 tip
After:
$ ./hg id --debug ☿ (revset-bench)
could not import hgext.evolve (No module named evolve): trying hgext3rd.evolve
could not import hgext.mercurial_keyring (No module named mercurial_keyring): trying hgext3rd.mercurial_keyring
could not import hgext3rd.mercurial_keyring (No module named mercurial_keyring): trying mercurial_keyring
could not import hgext.hggit (No module named hggit): trying hgext3rd.hggit
could not import hgext3rd.hggit (No module named hggit): trying hggit
21f507b8de2f9c1606e9aeb5ec7d2a6dedb7a4a7 tip
(This get worse if --traceback is used).
To work around this, we move this extensions related debug message behind a
new flag 'devel.debug.extensions' and restore the previous output.
I'm not fully happy about using the 'devel' section for a flag that can be
used by legitimate users to debug extensions issues. However, it fits well
next to other `devel.devel.*` options and is mostly used by extensions author
anyway.
We might move it to another, more appropriate section in the future (using
alias).
curses: use "text" interface if TERM=dumb
Differential Revision: https://phab.mercurial-scm.org/D3948
windows: expand '~/' and '~\' to %USERPROFILE% when translating to cmd.exe
It's convenient to be able to reference hooks in a portable location on any
platform.
windows: replace single quote with double quote when translating to cmd.exe
Since cmd.exe doesn't understand single quotes, single quotes to prevent $var
expansion is basically unusable without this. Single quote isn't allowed in a
path name, so it seems unlikely to come up otherwise.
hook: only print the note about native cmd translation if it actually changes
This makes it so that it will never occur on a non Windows platform.
hook: disable the shell to native command translation by default
There are other things I want to add like ~ expansion and translating single to
double quotes for cmd.exe. So off by default is safer.
I'm having second thoughts about the name, but I don't have any better ideas.
setup: allow to run setup.py with python 3 without a mercurial checkout
Some people may want to test mercurial in a python 3 environment through e.g.
pip, in which case setup.py doesn't run in a mercurial checkout, so the hack
in setup.py to allow python 3 cannot be overcome.
This change allows a manual override with the HGPYTHON3 environment variable.
Additionally, when for some reason the version is unknown (for crazy people
like me, who have a git checkout of the mercurial repo), the version variable
ends up being an unicode string, which fails the `isinstance(version, bytes)`
assertion. So fix that at the same time.
Differential Revision: https://phab.mercurial-scm.org/D3958