Matt Harbison <matt_harbison@yahoo.com> [Thu, 11 Mar 2021 17:02:28 -0500] rev 46682
typing: switch an argument type to the generic form
This fixes the following pytype complaint:
File "/mnt/c/Users/Matt/hg/mercurial/commands.py", line 4672, in log: Function mercurial.logcmdutil.parseopts was called with the wrong arguments [wrong-arg-types]
Expected: (ui, pats: List[Union[bytearray, bytes, memoryview]], ...)
Actually passed: (ui, pats: tuple, ...)
Differential Revision: https://phab.mercurial-scm.org/D10167
Matt Harbison <matt_harbison@yahoo.com> [Thu, 11 Mar 2021 21:25:28 -0500] rev 46681
typing: ensure that error.Abort is given bytes
There's a bunch more typing to be done here, but the list of things to fix is
already long, and I know there are instances where this is being used
incorrectly.
Differential Revision: https://phab.mercurial-scm.org/D10166
Matt Harbison <matt_harbison@yahoo.com> [Thu, 11 Mar 2021 21:21:41 -0500] rev 46680
typing: fix a suppression directive that was mangled by black formatting
It looks like black is moving comments needed by pytype out of position, and
causing some things that should be disabled to be enforced anyway.
Differential Revision: https://phab.mercurial-scm.org/D10165
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 04 Mar 2021 17:35:58 +0530] rev 46679
commit: reorder if-else conditional to give mergestate info priority
Looking at the code now, I was unable to find a good reason as why we only rely
on mergestate extras info after checking whether a filelog parent is ancestor of
other or not.
I mean if we have stored in mergestate that `other` was chosed, we should
blindly pick that one.
This cleanup will also help introduce more cases when both `fparent1` and
`fparent2` are non-null but using info from mergestate, we can fastpath.
The test change actually demonstrates the point of the patch. During merge we
were getting the other side of the file but on commit we were marking that as
merged.
Differential Revision: https://phab.mercurial-scm.org/D10147
Corey Schuhen <cschuhen@topcon.com> [Wed, 10 Mar 2021 15:24:52 +1000] rev 46678
enclink: check contents of symlinks not just size in case of fcrypt
Check content of symlinks because st_size may indicate the size of encrypted
data which does not match actual link value.
Differential Revision: https://phab.mercurial-scm.org/D10146
Martin von Zweigbergk <martinvonz@google.com> [Fri, 12 Feb 2021 16:13:34 -0800] rev 46677
rebase: inline simple function for finding obsolete subset of commits
`_filterobsoleterevs()` is just one line long. It was introduced in
2d294dada4f8 (rebase: small refactoring to allow better extensibility
from extensions, 2016-01-14), for use by the "inhibit" extension. That
extension was removed from the evolve repo in
87e87881059d (compat:
drop the inhibit hacky extension, 2017-10-24).
Differential Revision: https://phab.mercurial-scm.org/D10198
Joerg Sonnenberger <joerg@bec.de> [Thu, 25 Feb 2021 20:57:11 +0100] rev 46676
ci: hook network-io tests into the pipeline
This runs the "pip install" tests once for Python 2 and 3 each.
Differential Revision: https://phab.mercurial-scm.org/D10075
Augie Fackler <augie@google.com> [Fri, 12 Mar 2021 13:13:13 -0500] rev 46675
merge: with stable
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 18:24:23 +0100] rev 46674
test: update expected output in test-http.t
The output was introduced in
a4c19a162615 and is wrong and unstable. So we glob
it as other part of these tests already do.
Differential Revision: https://phab.mercurial-scm.org/D10153
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 10 Mar 2021 18:23:24 +0100] rev 46673
remotefilelog: remove unused import
This is no longer used since
a4c19a162615.
Differential Revision: https://phab.mercurial-scm.org/D10152
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Thu, 25 Feb 2021 10:08:33 -0500] rev 46672
wireprotov1peer: don't raise internal errors in some cases
Specifically, when the peer is closed in the middle of a batch of rpcs.
Differential Revision: https://phab.mercurial-scm.org/D10074
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Thu, 25 Feb 2021 10:00:08 -0500] rev 46671
sshpeer: don't fail forwarding output from closed connections
The test still shows an internal error, but one that happens
further along.
Differential Revision: https://phab.mercurial-scm.org/D10073
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Thu, 25 Feb 2021 09:59:23 -0500] rev 46670
test: show internal exception with batchable rpcs over ssh
Differential Revision: https://phab.mercurial-scm.org/D10072
Simon Sapin <simon.sapin@octobus.net> [Thu, 04 Mar 2021 13:26:53 +0100] rev 46669
rhg: Ignore trailing newlines in .hg/sharedpath
Differential Revision: https://phab.mercurial-scm.org/D10132
Simon Sapin <simon.sapin@octobus.net> [Tue, 02 Mar 2021 21:31:12 +0100] rev 46668
tests: Add `--rhg` and `--with-rhg=<path>` options for `run-tests.py`
They are mostly equivalent to the corresponding `chg` options.
For now, many tests are still failing in this configuration.
It is *not* run on CI.
Differential Revision: https://phab.mercurial-scm.org/D10095
Simon Sapin <simon.sapin@octobus.net> [Mon, 01 Mar 2021 20:36:06 +0100] rev 46667
rhg: Add support for automatic fallback to Python
`rhg` is a command-line application that can do a small subset of what
`hg` can. It is written entirely in Rust, which avoids the cost of starting
a Python interpreter and importing many Python modules.
In a script that runs many `hg` commands, this cost can add up.
However making users decide when to use `rhg` instead of `hg` is
not practical as we want the subset of supported functionality
to grow over time.
Instead we introduce "fallback" behavior where, when `rhg` encounters
something (a sub-command, a repository format, …) that is not implemented
in Rust-only, it does nothing but silently start a subprocess of
Python-based `hg` running the same command.
That way `rhg` becomes a drop-in replacement for `hg` that sometimes
goes faster. Whether Python is used should be an implementation detail
not apparent to users (other than through speed).
A new `fallback` value is added to the previously introduced
`rhg.on-unsupported` configuration key. When in this mode, the new
`rhg.fallback-executable` config is determine what command to use
to run a Python-based `hg`.
The previous `rhg.on-unsupported = abort-silent` configuration was designed
to let a wrapper script call `rhg` and then fall back to `hg` based on the
exit code. This is still available, but having fallback behavior built-in
in rhg might be easier for users instead of leaving that script "as an
exercise for the reader".
Using a subprocess like this is not idea, especially when `rhg` is to be
installed in `$PATH` as `hg`, since the other `hg.py` executable needs
to still be available… somewhere. Eventually this could be replaced
by using PyOxidizer to a have a single executable that embeds a Python
interpreter, but only starts it when needed.
Differential Revision: https://phab.mercurial-scm.org/D10093
Simon Sapin <simon.sapin@octobus.net> [Mon, 01 Mar 2021 16:18:42 +0100] rev 46666
rhg: Add a `rhg.on-unsupported` configuration key
For now the two values are:
* `abort-silent`: silently exit with code 252, the previous default behavior
* `abort`: print an error message about what feature
is not supported, then exit with code 252. Now the default.
Differential Revision: https://phab.mercurial-scm.org/D10091
Simon Sapin <simon.sapin@octobus.net> [Mon, 01 Mar 2021 13:51:35 +0100] rev 46665
rhg: Make configuration available as early as possible in main()
Differential Revision: https://phab.mercurial-scm.org/D10090
Simon Sapin <simon.sapin@octobus.net> [Tue, 02 Mar 2021 09:55:52 +0100] rev 46664
rust: Upgrade Cargo.lock to the newer format
As discussed in https://phab.mercurial-scm.org/D10085#153099
See https://github.com/rust-lang/cargo/pull/7070 and
https://blog.rust-lang.org/2020/01/30/Rust-1.41.0.html#less-conflict-prone-cargolock-format
Differential Revision: https://phab.mercurial-scm.org/D10089
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 14:48:36 -0500] rev 46663
sshpeer: enable+fix warning about sshpeers not being closed explicitly
I recommend looking at this with a diff that ignores indentation.
The test changes are because localrepo.close() updates some cache,
which appears happens earlier now on rollbacks or strips or something.
The http changes are because httppeer.close() prints stats with
--verbose.
Differential Revision: https://phab.mercurial-scm.org/D9999
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 14:40:17 -0500] rev 46662
sshpeer: add a develwarning if an sshpeer is not closed explicitly
The warning is disabled until the next commit, because fixing it
results in a noisy diff due to indentation changes.
Differential Revision: https://phab.mercurial-scm.org/D9998
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Mon, 15 Feb 2021 14:15:02 -0500] rev 46661
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 46660
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 46659
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 46658
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 46657
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 46656
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 46655
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 46654
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 46653
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 46652
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
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 10 Feb 2021 17:24:54 +0530] rev 46651
error: remove shortening of node in error message
This strips the complete 20 bytes node which was not found. Having the the full
node in error message is important as it makes debugging easier.
If a short node is to be displayed, that should be done by callers.
Differential Revision: https://phab.mercurial-scm.org/D9994