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
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 12:42:23 -0700] rev 43385
fsmonitor: refresh pywatchman with upstream
This commit vendors pywatchman commit
259dc66dc9591f9b7ce76d0275bb1065f390c9b1
from upstream without modifications. The previously vendored pywatchman
from changeset
16f4b341288d was from Git commit c77452.
This commit effectively undoes the following Mercurial changesets:
*
dd35abc409ee fsmonitor: correct an error message
*
b1f62cd39b5c fsmonitor: layer on another hack in bser.c for os.stat()
compat (
issue5811)
*
c31ce080eb75 py3: convert arguments, cwd and env to native strings when
spawning subprocess
*
876494fd967d cleanup: delete lots of unused local variables
*
57264906a996 watchman: add the possibility to set the exact watchman
binary location
The newly-vendored code has support for specifying the binary location,
so
57264906a996 does not need applied. But we do need to modify our
code to specify a proper argument name.
876494fd967d is not important, so it will be ignored.
c31ce080eb75 globally changed the code base to always pass
str to subprocess. But pywatchman's code is Python 3 clean, so
we don't need to do this.
This leaves
dd35abc409ee and
b1f62cd39b5c, which will be re-applied in
subsequent commits.
Differential Revision: https://phab.mercurial-scm.org/D7201
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 10:09:08 +0100] rev 43384
py3: encode strings before setting rev summary in gnuarch converter
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 09:56:10 +0100] rev 43383
py3: use raw string to query EmailMessage in gnuarch converter
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 09:52:13 +0100] rev 43382
py3: use mail.parsebytes() in gnuarch catlog parser
We drop 'catlogparser' attribute now unused.
Denis Laxalde <denis@laxalde.org> [Mon, 04 Nov 2019 09:35:10 +0100] rev 43381
tests: handle Message-Id line wrapping in test-notify-changegroup.t
This fixes this test on Python 3 with a long hostname. See changeset
4128ffba4431 for details.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 12:09:35 -0700] rev 43380
py3: define and use json.loads polyfill
Python 3.5's json.loads() requires a str. Only Python 3.6+
supports passing a bytes or bytearray.
This commit implements a json.loads() polyfill on Python 3.5
so that we can use bytes. The added function to detect encodings
comes verbatim from Python 3.7.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 11:48:38 -0700] rev 43379
contrib: require Python 3.6 for byteify-strings.py
This script makes use of `token.COMMENT`, which apparently
isn't present until Python 3.6. So make the script and its
test conditional on Python 3.6.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 11:42:46 -0700] rev 43378
demandimportpy3: only use lazy extension loader on Python 3.6+
There was an inline comment denoting a bug in the lazy extension
loader on Python 3.5 which prevents it from working there. But the
code was not conditional on the Python version.
The result of this was a myriad of failures on Python 3.5 due to
getattr() and friends not working on lazy extension modules.
By making extension modules non-lazy on Python 3.5, we reduce the
number of test failures from 48 to 22 on that Python version.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 02 Nov 2019 15:33:39 -0700] rev 43377
ui: flush before prompting for input with readline
I was using `hg absorb` with Python 3 and noticed that the
prompt was appearing without any output about what would be
done. After I answered the prompt, the output was printed
to stdout.
This appears to be a buffering difference between Python 2
and Python 3.
To work around it, this commit adds an explicit flush() before
calling the raw input function when readline is used.