Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 17 Mar 2021 20:06:35 +0100] rev 46809
revset: introduce a `nodefromfile` revset
I though we had one, but actually we don't seem to. So here is a revset to reuse
a list of node previously stored.
Differential Revision: https://phab.mercurial-scm.org/D10230
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Mar 2021 00:28:30 -0400] rev 46808
commands: necessary annotations and assertions to pass pytype
This is a slightly less forceful incarnation of D7384, where pytype can be
appeased with some assertions rather than disabling warnings.
Differential Revision: https://phab.mercurial-scm.org/D10236
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Mar 2021 23:41:00 -0400] rev 46807
typing: mark the argument to mercurial.i18n.gettext() non-Optional
Few if any of the callers are handling a `None` return, which is making pytype
complain. I tried adding @overload definitions to indicate the bytes -> bytes
and None -> None relationship, but pytype doesn't seem to apply that to `_()`
through the function assignment. What did work was to change `_()` into its own
function that called `gettext()`, but that has an extra function call overhead.
Even putting that function into an `if pycompat.TYPE_CHECKING` block and leaving
the existing assignments in the `else` block caused pytype to lose track of the
@overloads.
At that point, I simply gave up. PyCharm doesn't like that it can return None,
given the new type hints, but pytype doesn't complain about this nor does it
see any callers passing None. The most important thing here is to catch str
being passed anyway.
Differential Revision: https://phab.mercurial-scm.org/D10235