Manuel Jacob <me@manueljacob.de> [Tue, 31 May 2022 00:50:29 +0200] rev 49288
py3: constant-fold some `pycompat.ispy3`
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 15:38:01 +0200] rev 49287
py3: use `zip()` instead of trying to use `itertools.izip()`
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 15:33:39 +0200] rev 49286
py3: replace mention of “xrange” in docstring by “range”
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 15:32:43 +0200] rev 49285
py3: remove xrange() compatibility code
Some code used its own xrange() compatibility code instead of
pycompat.xrange().
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 15:17:27 +0200] rev 49284
py3: replace `pycompat.xrange` by `range`
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 12:38:54 +0200] rev 49283
hgweb: remove dead code handling UnicodeDecodeError
I’m quite confident that the error can’t happen on Python 3, as the main
motivation for separating bytes and str in Python 3 was to avoid this class of
errors.
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 12:28:31 +0200] rev 49282
cleanup: remove import of already imported module
Manuel Jacob <me@manueljacob.de> [Sun, 29 May 2022 12:25:24 +0200] rev 49281
cleanup: rename some functions to avoid redefinitions
Manuel Jacob <me@manueljacob.de> [Sat, 28 May 2022 22:08:13 +0200] rev 49280
thirdparty: remove Python 2-specific selectors2 copy
The selectors module was added in Python 3.4. Because we require Python 3.6, it
will always be available. Therefore the selectors2 module is not imported.
I’ve verified that the selectors2-specific workaround in commandserver.py is not
necessary with the selectors module from the standard library. It returns an
empty list if timeout was exceeded.
The pytype directive was needed to silence the following error:
File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on int [attribute-error]
In Union[_typeshed.HasFileno, int]
File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on _typeshed.HasFileno [attribute-error]
In Union[_typeshed.HasFileno, int]
Raphaël Gomès <rgomes@octobus.net> [Wed, 08 Jun 2022 15:46:04 +0200] rev 49279
branching: merge stable into default
Mathias De Mare <mathias.de_mare@nokia.com> [Wed, 08 Jun 2022 14:03:23 +0200] rev 49278
docker: avoid /tmp write access issues by fixing permissions
Manuel Jacob <me@manueljacob.de> [Sat, 04 Jun 2022 02:39:38 +0200] rev 49277
url: raise error if CONNECT request to proxy was unsuccessful
The deleted code didn’t work on Python 3. On Python 2 (or Python 3 after
adapting it), the function returned in the error case. The subsequent creation
of SSL socket fails during handshake with a nonsense error.
Instead, the user should get an error of what went wrong.
I don’t see how the deleted code would be useful in the error case. The new
code is also closer of what the standard library is doing nowadays that it has
proxy support (which we don’t use in the moment).
In the test, I use port 0 because all the HGPORTs were already taken. In
practice, there should not be any server listening on port 0.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 03 Jun 2022 17:18:46 +0200] rev 49276
revset: fix the doc of "nodefromfile"
This should maybe be called "nodesfromfile", but at least the documentation is
correct (it was previously a copy past from follow).
Manuel Jacob <me@manueljacob.de> [Thu, 02 Jun 2022 23:57:56 +0200] rev 49275
chg: replace mercurial.util.recvfds() by simpler pure Python implementation
On Python 3, we have socket.socket.recvmsg(). This makes it possible to receive
FDs in pure Python code. The new code behaves like the previous
implementations, except that it’s more strict about the format of the ancillary
data. This works because we know in which format the FDs are passed.
Because the code is (and always has been) specific to chg (payload is 1 byte,
number of passed FDs is limited) and we now have only one implementation and
the code is very short, I decided to stop exposing a function in
mercurial.util.
Note on terminology: The SCM_RIGHTS mechanism is used to share open file
descriptions to another process over a socket. The sending side passes an array
of file descriptors and the receiving side receives an array of file
descriptors. The file descriptors are different in general on both sides but
refer to the same open file descriptions. The two terms are often conflated,
even in the official documentation. That’s why I used “FD” above, which could
mean both “file descriptor” and “file description”.
Manuel Jacob <me@manueljacob.de> [Thu, 02 Jun 2022 04:39:49 +0200] rev 49274
py3: don’t subscript socket.error
On Python 2, socket.error was subscriptable. On Python 3, socket.error is an
alias to OSError and is not subscriptable. The except block passes the
exception to self.send_error(). This fails on both Python 2 (if it was
executed) and Python 3, as it expects a string.
Getting the attribute .strerror works on Python 2 and Python 3, and has the
same effect as the previous code on Python 2.
Anton Shestakov <av6@dwimlabs.net> [Mon, 06 Jun 2022 13:58:32 +0400] rev 49273
parsers: drop one extra argument to PyErr_Format
GCC gave the following warning during `make local`:
mercurial/cext/parsers.c: In function 'dirstate_item_from_v1_data':
mercurial/cext/parsers.c:413:30: warning: too many arguments for format [-Wformat-extra-args]
413 | "unknown state: `%c` (%d, %d, %d)", state, mode,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To reproduce, you might need to add the -Wformat-extra-args flag, because it
isn't present for me when building for the default python3. But I can see this
warning while simply building 6.1 with `make PYTHON=python2 clean local`.
I don't think this NULL was useful, because other instances of PyErr_Format()
don't have any NULLs as the final argument, but keep in mind that I don't know
python's C API.