Matt Harbison <matt_harbison@yahoo.com> [Wed, 09 Dec 2020 18:21:16 -0500] rev 46093
windows: continue looking at `%HOME%` for user config files with py3.8+
The `%HOME%` variable is explicitly called out in `hg help config` as a location
that is consulted when reading user files, but python stopped looking at it
when expanding '~' in py3.8+.[1] Restore that old functionality by copying in
the old implementation (and simplifying it to just use bytes). It could be
simplfied further, since only '~' is passed, but I'm not sure yet if we need to
make this a generic utility function on Windows. There are other uses of
`os.path.expanduser()`, but this is the only case I know of that documents
`%HOME%` usage.
(The reason for removing it was that it typically isn't set, but it actually is
set in MSYS and PowerShell, and `%HOME%` and `%USERPROFILE%` are different in
MSYS. I could be convinced to just replace all uses with this as a general
utility, so we don't have to think too hard about BC.)
[1] https://bugs.python.org/
issue36264
Differential Revision: https://phab.mercurial-scm.org/D9559
Matt Harbison <matt_harbison@yahoo.com> [Wed, 09 Dec 2020 15:50:59 -0500] rev 46092
run-tests: configure the environment to expand `~` properly with Windows py38+
This was causing tests to point to the actual home path on the system, not the
test defined one.
Differential Revision: https://phab.mercurial-scm.org/D9558
Matt Harbison <matt_harbison@yahoo.com> [Wed, 09 Dec 2020 12:57:40 -0500] rev 46091
run-tests: fix `HGTESTEXTRAEXTENSIONS` with py3
Since `extensions` was a str and `section` bytes, it never populated anything.
If it had, it would have put bytes into the environment dictionary that is all
str. As everything starts and ends as str, remove the incomplete attempt at
byteification. It doesn't appear that we had any test coverage of this bit of
code, so also add a non-extension config to make sure it is filtered out
properly.
Differential Revision: https://phab.mercurial-scm.org/D9557
Simon Sapin <simon-commits@exyr.org> [Fri, 04 Dec 2020 17:27:10 +0100] rev 46090
rhg: use persistent nodemap when available
… for node ID → revision number lookups, instead on linear scan in a revlog.
Differential Revision: https://phab.mercurial-scm.org/D9520
Simon Sapin <simon-commits@exyr.org> [Mon, 07 Dec 2020 18:06:53 +0100] rev 46089
persistent-nodemap: properly ignore non-existent `.nd` data file
This code was meant to handle the case of a nodemap docket file
pointing to a nodemap data file that doesn’t exist (anymore),
but most likely caused an `UnboundLocalError` exception instead
when `data` was used on the next line without being defined.
This case is theoretically possible with a race condition
between two hg processes, but is hard to reproduce or test:
* Process A reads a docket file and finds a UID in it
that points to a given data file name.
* Process B decides that this same data file needs compacting.
It writes a new one with a different UID,
overwrites the docket file,
then removes the old data file.
* Only then process A tries to a open a file that doesn’t exist anymore.
Differential Revision: https://phab.mercurial-scm.org/D9533
Martin von Zweigbergk <martinvonz@google.com> [Wed, 09 Dec 2020 18:51:52 -0800] rev 46088
docs: prefer `hg diff --from/--to` over `-r`
This patch includes updating away from the broken `hg diff -r
'date(...)'` (see not in previous patch).
Differential Revision: https://phab.mercurial-scm.org/D9555
Martin von Zweigbergk <martinvonz@google.com> [Wed, 09 Dec 2020 18:31:19 -0800] rev 46087
diff: add --from and --to flags as clearer alternative to -r -r
I think it was mistake to let the `-r` flag accept two revisions in
`hg diff` in
98633e60067c (Support for 0, 1, or 2 diff revs,
2005-05-07). The command clearly acts on two revisions and having a
single flag to indicate which those are is unclear. It got worse when
it started accepting revsets as input.
This patch introduces `--from` and `--to` flags, each taking a single
revision and each defaulting to the working copy. That means that `hg
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Dec 2020 17:18:49 +0530] rev 46086
commandserver: handle IOError related to flushing of streams
After dispatch, without chg we have handling of flushing of streams and
exception handling related to it. The exception handling part is important
because there can be exceptions when flushing fout or ferr.
One such case is in `test-basic.t` which was failing on python3+chg without this
patch as this handling was missing from chg.
Failure can be seen at
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/128399
Honestly I am not sure which one of `chgserver.py` or `commandserver.py` the
change should go in.
Differential Revision: https://phab.mercurial-scm.org/D9517
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 02 Dec 2020 14:27:45 +0530] rev 46085
tests: conditionalize output in test-ssh.t with chg+py3
Because of our wrapping around sys.std* and python3 internal buffering, the
output order changes. The change in order seems like harmless because just few
lines above the same command is run which results in same output.
This makes `test-ssh.t` works with --chg on python 3.
Differential Revision: https://phab.mercurial-scm.org/D9502
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 02 Dec 2020 14:19:09 +0530] rev 46084
dispatch: disable line ending normalization on sys.stdin if its None
Fixes test-chg.t on python 3 with chg.
Differential Revision: https://phab.mercurial-scm.org/D9501
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 02 Dec 2020 13:55:17 +0530] rev 46083
procutils: don't try to get `.buffer` if sys.stdin is None
While hunting down following test failure of test-chg.t on Python 3, I stumbled
the case when `.buffer` is not available as sys.stdin is None.
--- /home/pulkit/repo/hg-committed/tests/test-chg.t
+++ /home/pulkit/repo/hg-committed/tests/test-chg.t.err
@@ -203,7 +203,31 @@
$ CHGDEBUG=1 chg version -q 0<&-
chg: debug: * stdio fds are missing (glob)
chg: debug: * execute original hg (glob)
- Mercurial Distributed SCM * (glob)
+ Traceback (most recent call last):
+ File "/tmp/hgtests.avspvsq4/install/bin/hg", line 43, in <module>
+ dispatch.run()
+ File "/usr/lib/python3.6/importlib/util.py", line 233, in
__getattribute__
+ self.__spec__.loader.exec_module(self)
+ File "<frozen importlib._bootstrap_external>", line 678, in
exec_module
+ File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
+ File
"/tmp/hgtests.avspvsq4/install/lib/python/mercurial/dispatch.py", line
726, in <module>
+ class lazyaliasentry(object):
+ File
"/tmp/hgtests.avspvsq4/install/lib/python/mercurial/dispatch.py", line
737, in lazyaliasentry
+ @util.propertycache
+ File "/usr/lib/python3.6/importlib/util.py", line 233, in
__getattribute__
+ self.__spec__.loader.exec_module(self)
+ File "<frozen importlib._bootstrap_external>", line 678, in
exec_module
+ File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
+ File "/tmp/hgtests.avspvsq4/install/lib/python/mercurial/util.py",
line 3473, in <module>
+ f=procutil.stderr,
+ File "/usr/lib/python3.6/importlib/util.py", line 233, in
__getattribute__
+ self.__spec__.loader.exec_module(self)
+ File "<frozen importlib._bootstrap_external>", line 678, in
exec_module
+ File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
+ File
"/tmp/hgtests.avspvsq4/install/lib/python/mercurial/utils/procutil.py",
line 127, in <module>
+ stdin = sys.stdin.buffer
+ AttributeError: 'NoneType' object has no attribute 'buffer'
+ [1]
server lifecycle
----------------
Differential Revision: https://phab.mercurial-scm.org/D9500
Martin von Zweigbergk <martinvonz@google.com> [Wed, 09 Dec 2020 09:54:49 -0800] rev 46082
share: remove unexpected heading from "verbose" container in help test
`test-gendoc-*.t` have been failing for me since
91425656e2b1 (share:
add documentation about share-safe mode in `hg help -e share`,
2020-11-27) with this kind of output:
```
--- /usr/local/google/home/martinvonz/hg/tests/test-gendoc-ru.t
+++ /usr/local/google/home/martinvonz/hg/tests/test-gendoc-ru.t.err
@@ -2,3 +2,9 @@
$ $TESTDIR/check-gendoc ru
checking for parse errors
+ gendoc.txt:12818: (SEVERE/4) Unexpected section title.
+
+ Sharing requirements and configs of source repository with shares
+ -----------------------------------------------------------------
+ Exiting due to level-4 (SEVERE) system message.
+ [1]
```
This patch fixes that.
Differential Revision: https://phab.mercurial-scm.org/D9552
Mads Kiilerich <mads@kiilerich.com> [Thu, 03 Dec 2020 22:49:01 +0100] rev 46081
bugzilla: pass the url to xmlrpclib.ServerProxy as str
Mads Kiilerich <mads@kiilerich.com> [Thu, 03 Dec 2020 22:49:01 +0100] rev 46080
bugzilla: fix reporting of exceptions with py3
Yuya Nishihara <yuya@tcha.org> [Thu, 03 Dec 2020 18:42:23 +0900] rev 46079
ui: remove excessive strtolocal() from debuguigetpass
ui.getpass() returns Optional[bytes], and strtolocal(bytes) would crash.
Follows up
07b0a687c01a "ui: ensure `getpass()` returns bytes."
Joerg Sonnenberger <joerg@bec.de> [Tue, 08 Dec 2020 23:01:24 +0100] rev 46078
cext: match format string for 32bit long platforms
Differential Revision: https://phab.mercurial-scm.org/D9546
Martin von Zweigbergk <martinvonz@google.com> [Tue, 08 Dec 2020 13:33:40 -0800] rev 46077
status: disable morestatus when using -0
Without this patch, you get something like this:
```
M a\x00? a.orig\x00# The repository is in an unfinished *merge* state. (esc)
# Unresolved merge conflicts:
#
# a
#
# To mark files as resolved: hg resolve --mark FILE
# To continue: hg commit
# To abort: hg merge --abort
```
That doesn't seem like something one would ever want. I considered
making it an error to combine `-0` with morestatus, but it seems very
likely that that would just make the user spend time trying to figure
out how to disable morestatus, so it feels like we might as well just
do it for them.
Differential Revision: https://phab.mercurial-scm.org/D9545
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 06 Dec 2020 14:45:19 +0100] rev 46076
debugdiscovery: display some information about the initial "undecided" set
The size and shape of the revision that remains "undediced" once the fetched the
remote heads and queried the local one have a large impact on the discovery
performance, so we display some information about that set.
Differential Revision: https://phab.mercurial-scm.org/D9530
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 06 Dec 2020 06:19:15 +0100] rev 46075
debugdiscovery: add some data about the shapes of the sets
We display the number of heads and roots or the common and missing set.
Differential Revision: https://phab.mercurial-scm.org/D9529
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 21:44:00 -0500] rev 46074
tests: conditionalize the progress timestamp for Windows
It looks like for py2 on Windows, the start date is 1970. It matches the other
platforms for py3, so I'm just going to match the tests and move on, given that
py2 is on the way out.
Differential Revision: https://phab.mercurial-scm.org/D9541
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 20:38:00 -0500] rev 46073
tests: conditionalize a few Windows specific error messages
Differential Revision: https://phab.mercurial-scm.org/D9540
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 20:32:05 -0500] rev 46072
tests: correct the output order about starting a background thread for Windows
I didn't track down where this change occurred. I assume it's related to some
buffering changes, and/or an explicit flush somewhere.
Differential Revision: https://phab.mercurial-scm.org/D9539
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 20:57:50 -0500] rev 46071
tests: update the exit status codes for Windows specific tests
This corresponds to
527ce85c2e60,
ebee234d952a, and
568c05d8f3d2.
Differential Revision: https://phab.mercurial-scm.org/D9538
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 20:53:01 -0500] rev 46070
tests: drop the trailing exclamation point from some Windows abort messages
This likely goes with
95c4cca641f6.
Differential Revision: https://phab.mercurial-scm.org/D9537
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 16:37:22 -0500] rev 46069
tests: update output for test-check-pylint.t
The py3 version on Windows appends "(previous run: 10.00/10, +0.00)" with py39.
I didn't see that for the exact same version on Linux (with py3.6.9).
Differential Revision: https://phab.mercurial-scm.org/D9536
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 16:32:30 -0500] rev 46068
run-tests: extend PATH on Windows to include user installed scripts
This allows the test environment to see pylint.exe when installed with
`pip install --user`, since it isn't normally on PATH.
Differential Revision: https://phab.mercurial-scm.org/D9535
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 16:18:28 -0500] rev 46067
run-tests: stuff a `python3.exe` into the test bin directory on Windows
Windows doesn't have `python3.exe` as part of the python.org distribution, and
that broke every script with a shebang after
c102b704edb5. Windows itself
provides a `python3.exe` app execution alias[1], but it is some sort of reparse
point that MSYS is incapable of handling[2]. When run by MSYS, it simply prints
$ python3 -V
- Cannot open
That in turn caused every `hghave` check, and test that invokes shebang scripts
directly, to fail. Rather than try to patch up every script call to be invoked
with `$PYTHON` (and regress when non Windows developers forget), copying the
executable into the test binary directory with the new name just works. Since
this directory is prepended to the system PATH value, it also overrides the
broken execution alias. (The `_tmpbindir` is used instead of `_bindir` because
the latter causes python3.exe to be copied into the repo next to hg.exe when
`test-run-tests.t` runs. Something runs with this version of the executable and
subsequent runs of `run-tests.py` inside `test-run-tests.t` try to copy over it
while it is in use, and fail. This avoids the failures and the clutter.)
I didn't conditionalize this on py3 because `python3.exe` needs to be present
(for the shebangs) even when running py2 tests. It shouldn't matter to these
simple scripts, and I think the intention is to make the test runner use py3
always, even if testing a py2 build. For now, still supporting py2 is helping
to clean up the mess that is py3 tests.
[1] https://stackoverflow.com/a/
57168165
[2] https://stackoverflow.com/questions/
59148628/solved-unable-to-run-python-3-7-on-windows-10-permission-denied#comment
104524397_
59148666
Differential Revision: https://phab.mercurial-scm.org/D9543
Matt Harbison <matt_harbison@yahoo.com> [Mon, 07 Dec 2020 23:15:35 -0500] rev 46066
run-tests: fix a typo in an attribute name
At least, I assume it's a typo. Nothing else uses it, but `_tmpbindir` is used.
Differential Revision: https://phab.mercurial-scm.org/D9542
Yuya Nishihara <yuya@tcha.org> [Mon, 07 Dec 2020 20:12:36 +0900] rev 46065
test-extension: flush diagnostic message to stabilize chg output
Since chg server may create new file object for the attached stdout,
procutil.stdout is not ui.fout and the buffered procutil.stdout data wouldn't
be flushed at all. That's why test-extension.t passes without modification
on Python 2.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 03 Dec 2020 01:45:23 -0500] rev 46064
formatting: re-blacken match.py
Differential Revision: https://phab.mercurial-scm.org/D9512