Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 14:15:02 -0500] rev 46700
remotefilelog: rework workaround for sshpeer deadlocks
The wrapping of `sshpeer.cleanup` silently broke when `cleanup` was
renamed to `_cleanup`, a couple of years ago.
I don't know what `orig.im_self` is, but regardless, the intention of
the wrapping seems pretty clear: close stderr before
sshpeer._cleanuppipes blocks on it. So do that.
Differential Revision: https://phab.mercurial-scm.org/D9997
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 14:11:38 -0500] rev 46699
sshpeer: add a method to check if a doublepipe is closed
So we can tell in a next commit if we're trying to close an already
closed connection or not (in which case, we may warn).
Differential Revision: https://phab.mercurial-scm.org/D9996
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 13:59:36 -0500] rev 46698
sshpeer: make sshpeer.close() close the underlying connection
So the connection can be closed eagerly in future commits, instead of
relying on __del__.
Differential Revision: https://phab.mercurial-scm.org/D9995
Simon Sapin <simon.sapin@octobus.net> [Mon, 11 Jan 2021 13:33:00 +0100] rev 46697
copies-rust: add a macro-based unit-testing framework
`compare_values`, `merge_copies_dict`, and `CombineChangesetCopies`
are APIs whose signatures involve non-trivial types.
Calling them directly in unit tests would involve a lot of verbose
setup code that obscures the meaningful parts of a given test case.
This adds a macro-based test-harness with pseudo-syntax to tersely
create arguments and expected return values in the correct types.
For now there is only one (not particularly meaningful) test case
per tested function, just to exercize the macros.
Differential Revision: https://phab.mercurial-scm.org/D10071
Simon Sapin <simon.sapin@octobus.net> [Wed, 06 Jan 2021 23:11:59 +0100] rev 46696
copies-rust: rewrite ChangedFiles binary parsing
by using the new from-bytes-safe crate and a custom struct
that encodes the expected data structure.
Differential Revision: https://phab.mercurial-scm.org/D10068
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 02 Mar 2021 00:02:25 +0530] rev 46695
tags: validate nodes in _getfnodes() and update cache in case of unknown nodes
`hgtagsfnodescache` can contain unknown nodes due to cache corruption and this
lead to a traceback on operations like `hg tags` as we don't validate nodes.
This patch validates that all filenodes returned after `hgtagsfnodescache` are
known to the repository. If there exists any unknown filenode, we force
recompute it and update the cache.
The test change demonstrates the fix.
Differential Revision: https://phab.mercurial-scm.org/D10083
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 15 Feb 2021 17:08:18 +0530] rev 46694
debugtagscache: verify that filenode is correct
Previous patch from Matt demonstrates that `debugtagscache` does not warn about
filenode being unknown which can be caused by a corrupted cache.
We start by showing that it's an unknown node.
Differential Revision: https://phab.mercurial-scm.org/D10015
Matt Harbison <matt_harbison@yahoo.com> [Thu, 24 Dec 2020 12:23:46 -0500] rev 46693
tests: demonstrate a case where a corrupt tag cache causes an abort
I happened to hit this trying to cover other cases around valid vs missing
entries. I have no idea if this is something that could occur more naturally
(similar to how a missing file node in `hgtagsfnodes1` can occur after a strip).
There is a test just above this added in f5a7cf0adb12 mentioning it "overwrites
the junk", though that tests truncation instead of actual garbage.
But since this is just a cache, it probably shouldn't abort with a cryptic
message like this. The two options I see both have downsides- either rebuild
the cache (and potentially take a long time), or hint to the user to run a debug
command.
Differential Revision: https://phab.mercurial-scm.org/D9812
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 16 Feb 2021 20:38:14 +0530] rev 46692
debugcommands: prevent using `is False`
I was touching this code in a future patch and marmoute warned about usage of
`is False` here.
Quoting marmoute:
```
"is False" is going to check if the object you have the very same object in
memory than the one Python allocated for False (in practice 0)
This will "mostly work" on cpython because of implementation details, but
is semantically wrong and can start breaking unexpectedly
```
Differential Revision: https://phab.mercurial-scm.org/D10014
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 16 Feb 2021 18:43:42 +0530] rev 46691
hgtagsfnodes: refactor code to compute fnode into separate fn
I plan to use this code at one more place while fixing a bug caused by an
invalid fnode present in cache.
Differential Revision: https://phab.mercurial-scm.org/D10013