windows: always work around EINVAL in case of broken pipe for stdout / stderr
In
29a905fe23ae, I missed the fact that the `winstdout` class works around two
unrelated bugs (size limit when writing to consoles and EINVAL in case of
broken pipe) and that the latter bug happens even when no console is involved.
When writing a test for this, I realized that the same problem applies to
stderr, so I applied the workaround for EINVAL to both stdout and stderr.
The size limit is worked around in the same case as before (consoles on Windows
on Python 2). For that, I changed the `winstdout` class.
tests: make pipes / PTYs non-inheritable in test-stdio.py
A following patch requires that to test closing the receiving end of the pipe /
PTYs.
Even for existing tests, it might be safer to make the lifetime of the pipes /
PTYs as short as possible.
util: enhance `nullcontextmanager` to be able to return __enter__ result
This makes its functionality and signature equivalent to Python 3.7’s
contextlib.nullcontext().
discovery: change users of `outgoing.missingheads` to `outgoing.ancestorsof`
The attribute `missingheads` was recently renamed to `ancestorsof`, as it,
despite the old name, doesn’t contain the missing heads but the changesets that
were requested (including ancestors) for the outgoing operation.
Changing all the users enables to print a warning if the old name is used.
There is a good chance that some of the users are buggy because of the old name.
Changing them to use the new name makes it more obvious that they are buggy. All
users need to be reviewed for bugs. When sending patches for fixing them, the
change will be more obvious without having to explain again and again the
discrepancy of the old attribute name and what it actually contained.
discovery: fix docstring of `outgoing` class
Also, introduce a more correct name `ancestorsof` for what was named
`missingheads` before. For now, we just forward `ancestorsof` to `missingheads`
until all users are changed.
There were some mistakes in the old docstring / name:
* `missingheads` (new name: `ancestorsof`) contains the revs whose ancestors
are included in the outgoing operation. It may contain non-head revs and revs
which are already on the remote, so the name "missingheads" is wrong in two
ways.
* `missing` contains only ancestors of `missingheads`, so not *all nodes*
present in local but not in remote.
* `common` might not contain all common revs, e.g. not some that are not an
ancestor of `missingheads`.
It seems like the misleading name have fostered an actual bug (
issue6372),
where `outgoing.missingheads` was used assuming that it contains the heads of
the missing changesets.
discovery: weaken claim about returned common heads if ancestorsof are given
As the test case shows, the claim is not true in general.
cext: remove unused variables
Differential Revision: https://phab.mercurial-scm.org/D8760