Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 20:46:19 -0800] rev 43415
import-checker: open all source files as utf-8
Before, we opened in text mode and used the default encoding
to interpret the bytes within.
This caused problems interpreting some byte sequences in some
files.
This commit changes things to always open files as UTF-8, which
makes the error go away.
test-check-module-imports.t now passes on Python 3.5 and 3.6
with this change.
Differential Revision: https://phab.mercurial-scm.org/D7225
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 21:17:34 -0800] rev 43414
localrepo: use str for lookup in vars()
vars() returns a dict of str. So always use a native str for
the key lookup.
Differential Revision: https://phab.mercurial-scm.org/D7227
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 23:44:10 -0800] rev 43413
automation: install python3-venv Debian package
Debian's python install has a crippled venv by default, as it is
lacking ensurepip. When you try to run `python3 -m venv` it tells
you to install `python3-venv`. So this commit does that in our
automation environment so we can fully test installing Mercurial
using venv+pip with the system Python.
Differential Revision: https://phab.mercurial-scm.org/D7229
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 23:42:18 -0800] rev 43412
tests: look for ensurepip before using venv
Debian appears to cripple the venv module by default by
removing the associated ensurepip functionality. (The module
isn't present at all.) This caused test-install.t to fail when
using the Debian python3 unless the python3-venv package was
installed.
This commit introduces a new hghave requirement for detecting
ensurepip and makes the Python 3 install variant conditional on
its presence. This should make test-install.t pass when
using an incomplete Debian Python.
Differential Revision: https://phab.mercurial-scm.org/D7228
Matt Harbison <matt_harbison@yahoo.com> [Thu, 17 Oct 2019 16:46:13 -0400] rev 43411
automation: avoid '~' in the temp directory on Windows
If a long-ish username is used, the environment variable ends up with a '~' to
be 8.3 path compatible. That in turn causes a handful of tests (mostly ssh
related) to add quotes around $TESTMP.
I have no AWS experience, so I have no idea if this is the proper way to do it.
But I've hit this problem locally, and redirecting the directory is a
workaround. I don't recall if the directory is created on demand by the test
harness, but presumably if this is configured before the machine boots, Windows
will do it for us.
Differential Revision: https://phab.mercurial-scm.org/D7130
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 20:33:38 -0800] rev 43410
tests: use venv on Python 3
This test was failing in some Python 3 environments because
`$PYTHON -m virtualenv` was somehow resulting in Python 2
being used. Why, I'm not sure.
Python 3 includes virtualenv in the standard library as the
`venv` module.
This commit changes test-install.t to use `$PYTHON -m venv` on
Python 3 and `$PYTHON -m virtualenv` on Python 2 (if available).
I chose to make some test output duplicated because we can't
have nested conditionals and there is no easy way to express
ORing of hghave checks.
Differential Revision: https://phab.mercurial-scm.org/D7224
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 20:10:51 -0800] rev 43409
tests: remove HGALLOWPYTHON3 reference
This variable was removed from setup.py in
c3e10f705a6c.
Differential Revision: https://phab.mercurial-scm.org/D7223
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 04 Nov 2019 20:21:31 -0800] rev 43408
run-tests: use byte strings for inserted output
We were inserting str on Python 3 which resulted in mixed
str/bytes types on the list. This would later blow up when
trying to write str to the .err file opened in bytes mode.
Differential Revision: https://phab.mercurial-scm.org/D7222
Ian Moody <moz-ian@perix.co.uk> [Mon, 04 Nov 2019 19:19:36 +0000] rev 43407
contrib: require Python 3.7 for byteify-strings.py
bb509f39d387 made an error, it's actually 3.7 that introduced token.COMMENT.
Differential Revision: https://phab.mercurial-scm.org/D7220
Augie Fackler <augie@google.com> [Mon, 04 Nov 2019 12:20:11 -0500] rev 43406
hghave: fix bytes/string issue on Python 3
Mathias De Mare <mathias.de_mare@nokia.com> [Mon, 04 Nov 2019 07:56:53 +0100] rev 43405
packaging: add support for CentOS 8
The resulting executable has not been tested in detail yet.
I ran 'hg version' and 'hg clone', which worked fine
(except for extensions acting up due to Python 3).
Differential Revision: https://phab.mercurial-scm.org/D7216
Mathias De Mare <mathias.de_mare@nokia.com> [Mon, 04 Nov 2019 07:40:32 +0100] rev 43404
packaging: allow choosing python version depending on centos version
Differential Revision: https://phab.mercurial-scm.org/D7217
Ian Moody <moz-ian@perix.co.uk> [Mon, 04 Nov 2019 19:05:44 +0000] rev 43403
fsmonitor: use stringutil.forcebytestr() instead of str() on an exception
Similar to
5fa8ac91190e / D7206, should get test-install.t passing on py3.
Differential Revision: https://phab.mercurial-scm.org/D7218
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 16:13:01 +0100] rev 43402
py3: add a __str__ method to Abort
This improves the rendering of some exceptions by avoiding raw
bytestrings, especially when using --traceback option.
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 16:04:09 +0100] rev 43401
py3: add Python 3 exception output to test-lfs-serve-access.t
Similar to
a973a75e92bf or
3e9c6cef949b.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 31 Oct 2019 19:54:58 -0700] rev 43400
automation: install black
This should unblock us from running the code formatting test in
our automated environment.
Differential Revision: https://phab.mercurial-scm.org/D7197
Ian Moody <moz-ian@perix.co.uk> [Sat, 02 Nov 2019 22:21:25 +0000] rev 43399
py3: use %d to format an int
Avoids a TypeError under py3. Fortunately this is very much an edge case since
it requires the user to have deliberately created a local tag of the form
'D\d+' that isn't truthful.
Differential Revision: https://phab.mercurial-scm.org/D7215
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 15:02:35 -0700] rev 43398
fsmonitor: normalize exception types to bytes
Unavailable.msg should now always be bytes.
We also rename Unavailable.__str__ to __bytes__ as it always
returns bytes. We make __str__ a simple wrapper that decodes that
result to str.
There's probably some excessive strutil.forcebytestr() in
fsmonitor/__init__.py now. But at least the exceptions around
type coercion should now be gone.
Differential Revision: https://phab.mercurial-scm.org/D7214
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 14:55:45 -0700] rev 43397
fsmonitor: normalize clock value to bytes
We normalize the value returned by watchman because
we perform a number of compares with this value in code.
So the easiest path forward is to normalize to bytes so we
don't have to update many call sites.
With this commit, the fsmonitor extension appears to be working
with Python 3! Although there are still some failures in edge
cases...
Differential Revision: https://phab.mercurial-scm.org/D7213
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 14:27:55 -0700] rev 43396
fsmonitor: use next() instead of .next()
This is needed for Python 3 compatibility.
Differential Revision: https://phab.mercurial-scm.org/D7212
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 14:26:06 -0700] rev 43395
fsmonitor: normalize Watchman paths to bytes
Otherwise it will be a str on Python 3 and operations below
which operate in the bytes domain will fail.
Differential Revision: https://phab.mercurial-scm.org/D7211
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 14:17:48 -0700] rev 43394
fsmonitor: handle unicode keys in tuples
In Python 3, keys in the bset tuple are typically str, not
bytes. PyBytes_AsString() would return NULL. But we weren't
checking the return value and this would lead to a segfault.
This commit makes the code type and Python version aware. The
Python version specific code is to allow us to utilize a
modern API for converting str -> char* without having to
allocate an extra PyObject.
FWIW I wanted to assume that keys were always str. However,
there appear to be some bytes keys in some cases. I haven't
debugged this further.
Differential Revision: https://phab.mercurial-scm.org/D7210
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 13:39:23 -0700] rev 43393
fsmonitor: make _hashignore compatible with Python 3
The Hasher wants a bytes but we were feeding it a str. Let's
use our repr() implementation to return bytes.
In addition, the hexdigest() would return a str, which would be
compared against a bytes and would always fail. Normalize to
bytes so the compare works.
Differential Revision: https://phab.mercurial-scm.org/D7209
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 13:34:40 -0700] rev 43392
fsmonitor: normalize hostname to bytes
Without this, we get a str/bytes mismatching when using %
formatting a few lines below.
Differential Revision: https://phab.mercurial-scm.org/D7208
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 13:30:23 -0700] rev 43391
fsmonitor: access repo.root
There is no repo._root. It looks like fsmonitor has
been busted since this access was introduced in
ab1900323b1 in July 2019!
Differential Revision: https://phab.mercurial-scm.org/D7207
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 13:08:20 -0700] rev 43390
fsmonitor: coerce watchman exception to bytes
Without this, we get errors due to passing str to a function
which expects bytes.
Differential Revision: https://phab.mercurial-scm.org/D7206
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 13:04:47 -0700] rev 43389
fsmonitor: fix str/bytes mismatch when accessing watchman version
There were 2 bugs here. First, keys in the tuple are always
str. Second, we needed to normalize the value to bytes to
prevent a str/bytes mismatch on Python 3.
With this commit, `hg debuginstall` with fsmonitor enabled now
works on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D7205
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 12:54:47 -0700] rev 43388
fsmonitor: reapply
b1f62cd39b5c
The recent revendoring of pywatchman undid this changeset.
Let's reapply it.
This commit was generated by running `hg graft -f
b1f62cd39b5c`.
It applied cleanly.
Differential Revision: https://phab.mercurial-scm.org/D7204
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 12:52:58 -0700] rev 43387
fsmonitor: reapply
dd35abc409ee
The recent revendoring of pywatchman undid this bug fix.
Let's reapply it.
Differential Revision: https://phab.mercurial-scm.org/D7203
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 12:51:28 -0700] rev 43386
fsmonitor: remove pywatchman from exclusion rule
The recently vendored pywatchman code base is now formatted
with black. We can now remove pywatchman from our black
exclusion rule.
Differential Revision: https://phab.mercurial-scm.org/D7202