Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 01 Apr 2021 11:31:54 +0200] rev 47037
revlog: have an explicit "pack_header" method
Having to pass the version header when retrieving the binary version of every
single entry is a bit silly. So we extract that special logic in its own method.
This also prepare the move to newer revlog format, not storing the header within
an actual entry…
Differential Revision: https://phab.mercurial-scm.org/D10510
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 01 May 2021 14:47:39 +0200] rev 47036
revlog: remove the revlogio class
The class only contains a single `parseindex` method. Lets just make it a
function and remove the `revlogio` class. It served us well but became thinner
and thinner overtime.
Differential Revision: https://phab.mercurial-scm.org/D10509
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 01 May 2021 14:47:33 +0200] rev 47035
revlog: fix some comment style
They displease check-code.
Differential Revision: https://phab.mercurial-scm.org/D10542
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 08 Apr 2021 00:01:11 +0200] rev 47034
revlog: add a `entry_binary` method on index
The revlog index is already responsible for unpacking the binary entry, it would be
simpler to make it responsible for packing them. In practice the C version of
the index is already doing this internally.
We introduce a "entry_binary" method that return the binary version of an
existing revision. The method currently need to also take the revlog header to
deal with the "first revision" special case. We will introduce further refactor
in a later changeset to split that logic out.
Differential Revision: https://phab.mercurial-scm.org/D10508
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 12:08:34 +0200] rev 47033
template: make an explicit closure for formatting entry in peerurls
This is about to be become significantly more complicated as `ui.path[x]` will
become a list.
Differential Revision: https://phab.mercurial-scm.org/D10443
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 11:50:08 +0200] rev 47032
template: use `list_paths` in `peerurls`
Using common code will make it simpler to update the logic behind the path
definition and storage.
Differential Revision: https://phab.mercurial-scm.org/D10442
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 11:48:29 +0200] rev 47031
paths: use `list_paths` in `hg paths`
Using common code will make it simpler to update the logic behind the path
definition and storage.
Differential Revision: https://phab.mercurial-scm.org/D10441
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 11:46:31 +0200] rev 47030
urlutil: introduce a new `list_paths` function
This function will be useful for command and template that wants to display path
related information.
Differential Revision: https://phab.mercurial-scm.org/D10440
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 10:05:51 +0200] rev 47029
urlutil: deprecate `getpath`
There as no remaining user of that function.
Differential Revision: https://phab.mercurial-scm.org/D10439
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 10:01:44 +0200] rev 47028
urlutil: inline the relevant part of `getpath` in `get_push_paths`
The part that `get_push_paths` needs is quite simple, inclining will help us
to deprecated `getpath`.
Differential Revision: https://phab.mercurial-scm.org/D10438
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 09:50:56 +0200] rev 47027
url_util: introduce a `try_path` function
That function… try a build a path, returning None on failure. This helps us to simplify various part of the existing code.
Differential Revision: https://phab.mercurial-scm.org/D10437
Martin von Zweigbergk <martinvonz@google.com> [Tue, 20 Apr 2021 11:22:35 -0700] rev 47026
narrow: add more status messages when narrowing
Each of the steps I added status messages for in this patch frequently
take minutes or tens of minutes for our internal users.
It would be nice to also have a progress bar but that will have to
come later.
Differential Revision: https://phab.mercurial-scm.org/D10503
Martin von Zweigbergk <martinvonz@google.com> [Tue, 20 Apr 2021 10:24:03 -0700] rev 47025
narrow: add progress-reporting when looking for local changes in `hg tracked`
Looking for local changes (changes not on the given remote) can take a
long time, so we should have progress-reporting for it.
Differential Revision: https://phab.mercurial-scm.org/D10501
Kyle Lippincott <spectral@google.com> [Fri, 16 Apr 2021 16:21:26 -0700] rev 47024
chg: pass --no-profile to disable profiling when starting hg serve
If profiling is enabled via global/user config (as far as I can tell, this
doesn't affect use of the --profile flag, but it probably does affect --config
profiling.enabled=1), then the profiling data can be *cumulative* for the
lifetime of the chg process.
This leads to some "interesting" results where hg claims the walltime is
something like 200s on a command that took only a second or two to run. Worse,
however, is that with at least some profilers (such as the default "stat"
profiler), this can cause a large slowdown while generating the profiler output.
Differential Revision: https://phab.mercurial-scm.org/D10470
Kyle Lippincott <spectral@google.com> [Fri, 16 Apr 2021 15:31:05 -0700] rev 47023
profiling: add --no-profile to disable profiling enabled via config
Differential Revision: https://phab.mercurial-scm.org/D10469
Kyle Lippincott <spectral@google.com> [Fri, 16 Apr 2021 18:56:26 -0700] rev 47022
tests: fix test-chg to ignore a warning about being unable to set locale
This is apparently coming from bash when bash is providing the sh that we're
using to execute the .sh file generated by run-tests for this test.
Bash on my machine:
```
$ sh --version
GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ sh
sh-5.1$ LC_CTYPE=unsupported_value echo hi
sh: warning: setlocale: LC_CTYPE: cannot change locale (unsupported_value): No such file or directory
hi
```
Differential Revision: https://phab.mercurial-scm.org/D10468
Martin von Zweigbergk <martinvonz@google.com> [Tue, 27 Apr 2021 14:36:52 -0700] rev 47021
branch: delete obsolete message about changing branch of obsolete commit
We now rely on `rewriteutil.precheck()` to check for divergence, so we
don't need the extra check in `cmdutil.changebranch()`. The former
check is a little less strict in that it allows you to rewrite a
commit without non-obsolete successors.
Differential Revision: https://phab.mercurial-scm.org/D10519
Martin von Zweigbergk <martinvonz@google.com> [Tue, 23 Feb 2021 10:28:42 -0800] rev 47020
rewriteutil: check for divergence
This code is adapted from the code in the evolve extension. It seems
to be equivalent as far as the evolve extension's test suite can tell
(the only impact when making their `precheck()` delegate to our
version is that error messages are less detailed).
I had to change the error message to work with "change branch of"
being inserted as the action.
Differential Revision: https://phab.mercurial-scm.org/D10518
Martin von Zweigbergk <martinvonz@google.com> [Wed, 28 Apr 2021 08:48:10 -0700] rev 47019
rewriteutil: adapt "cannot %s while merging" to work with "change branch of"
`rewriteutil.precheck()` creates error messages by inserting a given
verb into a sentence. The `hg branch -r` command passes in "change
branch of" as the verb. That doesn't work well with "cannot %s while
merging" (making it "cannot change branch of while merging"). Let's
insert a "changeset" there to make it work better.
Building sentences like this seems obviously bad for i18n, but fixing
that is out of scope for this series, IMO.
Differential Revision: https://phab.mercurial-scm.org/D10530
Martin von Zweigbergk <martinvonz@google.com> [Thu, 11 Feb 2021 15:11:10 -0800] rev 47018
rewriteutil: point to help about instability when rewriting creates orphan
This replicates the message from the evolve extension.
Differential Revision: https://phab.mercurial-scm.org/D10517
Martin von Zweigbergk <martinvonz@google.com> [Tue, 27 Apr 2021 14:59:45 -0700] rev 47017
help: add topic about evolution, based on text from evolve extension
I've taken the text produced by `hg help evolution` when the evolve
extension is enabled and made that available by the same command with
just hg core. Changes I've made:
* Added "(EXPERIMENTAL)" to the title. (That doesn't hide the topic
from `hg help`, though.)
* Replaced old-style `experimental.evolution=<names>` config by
new-style `experimental.evolution.<name>=true`.
* Replaces a "obsolete markers" by "obsolescence markers".
* Removed most content from "Current feature status".
When the evolve extension is enabled, its help text takes precedence.
Differential Revision: https://phab.mercurial-scm.org/D10516
Martin von Zweigbergk <martinvonz@google.com> [Thu, 11 Feb 2021 15:02:57 -0800] rev 47016
rewriteutil: add devel warning if precheck is called with contexts
I'm trying to upstream parts from the evolve extension. This check
exists there.
Differential Revision: https://phab.mercurial-scm.org/D10515
Martin von Zweigbergk <martinvonz@google.com> [Tue, 27 Apr 2021 11:02:41 -0700] rev 47015
rewriteutil: replace "null changeset" by "the null revision" in error message
The evolve extension uses "the null revision" and we seem to use that
term much more frequently in core too.
Differential Revision: https://phab.mercurial-scm.org/D10514
Martin von Zweigbergk <martinvonz@google.com> [Tue, 20 Apr 2021 08:28:11 -0700] rev 47014
relnotes: copy contents of "next" to "5.8" and clear "next"
The same procedure as every year^Wcycle.
Unlike previous cycles, I haven't actually recorded the copy because
we don't want to propagate further changes in "next" (from the stable
branch) to "5.8".
Differential Revision: https://phab.mercurial-scm.org/D10500
Kyle Lippincott <spectral@google.com> [Tue, 20 Apr 2021 13:01:47 -0700] rev 47013
dirstateguard: use mktemp-like functionality to generate the backup filenames
Previously these were generated with names like:
`dirstate.backup.commit.<memory address of dirstateguard>`
This could cause problems if two hg commands ran at the same time that used the
same memory address, (which is apparently not uncommon if chg is involved), as
memory addresses are not unique across processes.
This issue was reported in the post-review comments on
http://phab.mercurial-scm.org/D9952.
Differential Revision: https://phab.mercurial-scm.org/D10504
Joerg Sonnenberger <joerg@bec.de> [Mon, 29 Mar 2021 01:52:06 +0200] rev 47012
node: replace nullid and friends with nodeconstants class
The introduction of 256bit hashes require changes to nullid and other
constant magic values. Start pushing them down from repository and
revlog where sensible.
Differential Revision: https://phab.mercurial-scm.org/D9465
Georges Racinet <georges.racinet@octobus.net> [Sat, 24 Apr 2021 16:30:05 +0200] rev 47011
repoview: separate concerns in _filteredrepotypes comment
The cited issue in Python bugtracker is closed, but hasn't been
fixed. We've been able to use the attached example and reproduce
it with Python 3.9.
The point where it turns from needless stress on the GC to
the an actual leak is when one factors in the fact that the GC
was before Python 3.4 unable to collect some types (see PEP 442).
Note that even with Python 2.7, the simple example of cycles
due to __mro__ are collectable. This was seen again with the
example attached on the CPython issue.
Georges Racinet <georges.racinet@octobus.net> [Fri, 23 Apr 2021 18:30:53 +0200] rev 47010
repoview: fix memory leak of filtered repo classes
The leak occurs in long-running server processes with
extensions, and is measured at 110kB per request.
Before this change, the contents of the `_filteredrepotypes`
cache are not properly garbage collected, despite it begin
a `WeakKeyDictionary`.
Extensions have a tendency to generate a new repository class
for each `localrepo` instantiation. Server processes based
on `hgwebdir_mod` will instantiate a new `localrepo` for each
HTTP request that involves a repository.
As a result, with a testing process that repeatedly opens a
repository with several extensions activated
(`topic` notably among them), we see a steady increase in
resident memory of 110kB per repository instantiation before this
change. This is also true, if we call `gc.collect()` at each
instantiation, like `hgwebdir_mod` does, or not.
The cause of the leak is that the *values* aren't weak references.
This change uses `weakref.ref` for the values, and this makes
in our measurements the resident size increase drop to 5kB per
repository instantiation, with no explicit call of `gc.collect()`
at all.
There is currently no reason to believe that this remaining leak
of 5kB is related to or even due to Mercurial core.
We've also seen evidence that `ui.ui` instances weren't properly
garbage collected before the change (with the change, they are).
This could explain why the figures are relatively high.
In theory, the collection of weak references could lead to
much more misses in the cache, so we measured the impact on
the original case that was motivation for introducing that cache
in
7e89bd0cfb86 (see also
issue5043): `hg convert` of the
mozilla-central repository. The bad news here is that there is a
major memory leak there, both with and without the present changeset.
There were no more cache misses, and we could see no
more memory leak with this change: the resident size after importing
roughly 100000 changesets was at 12.4GB before, and 12.5GB after.
The small increase is mentioned for completeness only, and we
believe that it should be ignored, at least as long as the main
leak isn't fixed. At less than 1% of the main leak, even finding out
whether it is merely noise would be wasteful.
Original context where this was spotted and first mitigated:
https://foss.heptapod.net/heptapod/heptapod/-/issues/466
The leak reduction was also obtained in Heptapod inner HTTP server,
which amounts to the same as `hgwebdir_mod` for these questions.
The measurements done with Python 3.9, similar figures seen with 3.8.
More work on our side would be needed to give measurements with 2.7,
because of testing server process does not support it.
Georges Racinet <georges.racinet@octobus.net> [Sat, 24 Apr 2021 15:46:39 +0200] rev 47009
repoview: style change in newtype() cache handling
This way of writing it does not change the logic at all,
but is more fit for the change we want to make in the
next changeset.
If anything, that's one dict lookup less in the hot path,
but that should be non measurable.
Joerg Sonnenberger <joerg@bec.de> [Thu, 22 Apr 2021 02:57:30 +0200] rev 47008
tests: don't hard-code /bin/bash
From Thomas Klausner in pkgsrc.
Differential Revision: https://phab.mercurial-scm.org/D10507
Raphaël Gomès <rgomes@octobus.net> [Wed, 21 Apr 2021 17:59:14 +0200] rev 47007
lint: fix failing code check
8d2b62d716b0 introduced code that `test-check-code.t` wasn't happy about, this
fixes it.
Differential Revision: https://phab.mercurial-scm.org/D10506
Matt Harbison <matt_harbison@yahoo.com> [Wed, 14 Apr 2021 09:49:36 -0400] rev 47006
typing: enable pytype processing on mercurial/upgrade_utils/actions.py
This was the suggested workaround for the pytype bug that caused this file to be
processed forever.
Differential Revision: https://phab.mercurial-scm.org/D10460
Matt Harbison <matt_harbison@yahoo.com> [Sun, 18 Apr 2021 00:56:09 -0400] rev 47005
incoming: use bytes for an error message
Caught by pytype.
Differential Revision: https://phab.mercurial-scm.org/D10461
Augie Fackler <augie@google.com> [Wed, 21 Apr 2021 10:58:42 -0400] rev 47004
merge: stable heads
I forgot to pull before rolling rc1, so we just have a couple of
patches that missed the rc1 train. Mea culpa.
Augie Fackler <raf@durin42.com> [Wed, 21 Apr 2021 10:49:29 -0400] rev 47003
Added signature for changeset
8d2b62d716b0
Augie Fackler <raf@durin42.com> [Wed, 21 Apr 2021 10:49:28 -0400] rev 47002
Added tag 5.8rc1 for changeset
8d2b62d716b0
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 16:31:13 +0200] rev 47001
relnote: mention a nodemap bug fixes
The fix was in
a3720569a43f.
Differential Revision: https://phab.mercurial-scm.org/D10499
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 16:29:05 +0200] rev 47000
relnote: document the use of persistent-nodemap by default for Rust build
Differential Revision: https://phab.mercurial-scm.org/D10498
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 16:18:43 +0200] rev 46999
relnode: document the move to `zstd` as default compression
Differential Revision: https://phab.mercurial-scm.org/D10497
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 16:12:19 +0200] rev 46998
relnote: clarify the backward compatibility entry about p1/p2 swap
The previous message might read a bit scary. So we clarify that the nodeid are
not affected.
Differential Revision: https://phab.mercurial-scm.org/D10496
Matt Harbison <matt_harbison@yahoo.com> [Tue, 20 Apr 2021 23:31:36 -0400] rev 46997
mail: add a TODO about proper mbox locking
Per @nbjoerg in IRC, the mbox isn't locked correctly.
Differential Revision: https://phab.mercurial-scm.org/D10505
Joerg Sonnenberger <joerg@bec.de> [Tue, 20 Apr 2021 20:35:46 +0200] rev 46996
packaging: extract pre-computed version when running from plain tarball
The tarballs created by setup.py are not including the usual archive
markers that `hg archive` leaves, so the rewrite of the version number
computation actually left the empty version string around. This meant
that installations from PyPI would use 0.0.0 as version string.
Differential Revision: https://phab.mercurial-scm.org/D10502
Augie Fackler <raf@durin42.com> [Tue, 20 Apr 2021 11:12:20 -0400] rev 46995
Added signature for changeset
f67b8946bb1b
Augie Fackler <raf@durin42.com> [Tue, 20 Apr 2021 11:12:19 -0400] rev 46994
Added tag 5.8rc0 for changeset
f67b8946bb1b
Augie Fackler <augie@google.com> [Tue, 20 Apr 2021 11:01:06 -0400] rev 46993
merge: default into stable for 5.8 rc
Matt Harbison <matt_harbison@yahoo.com> [Mon, 19 Apr 2021 20:38:52 -0400] rev 46992
mail: force SMTPException to bytes before wrapping in error.Abort
Pytype wasn't complaining about this for some reason, but PyCharm was and we
already handle another instance of this exception the same way in this function.
Differential Revision: https://phab.mercurial-scm.org/D10473
Matt Harbison <matt_harbison@yahoo.com> [Mon, 19 Apr 2021 17:26:57 -0400] rev 46991
mail: split out the SMTP login to allow the keyring extension to wrap it
The keyring extension only needs to tweak this tiny section of the larger
function. But without any place to intercept the username/password fetching, it
copy/pasted the entire function, and has grown a bunch of compatibility hacks to
support older versions of Mercurial as well.
Differential Revision: https://phab.mercurial-scm.org/D10471
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 04:27:03 +0200] rev 46990
store: exclude `undo.` nodemap's file from `walk`
There are "temporary" local file that we should not be transfered by `walk` user
like local clone and stream clone.
This fix the small issue that the new tests highlighted.
Differential Revision: https://phab.mercurial-scm.org/D10482
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 20 Apr 2021 05:08:55 +0200] rev 46989
streamclone: treat volatile file as "fullfile"
The nodemap related file might change (or get deleted) during the stream clone
in a way incompatible with the streaming process.
So we introduce a new flag for this type of file and integrate it with the
existing `revlog_type` field recently added to `store.walk` returns.
We use that new flat to dispatch such file to the existing mechanism for "atomic
replacement" file for the nodemap docket and datafile. This fix the bugs we have
been adding tests for.
Strictly speaking, the nodemap datafile is happened only a could maybe be used
in a slightly more efficient way, however this is good enough for now.
Differential Revision: https://phab.mercurial-scm.org/D10481
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 20:47:46 +0200] rev 46988
nodemap: add a test about nodemap "vacuum" during stream clone
When the nodemap "vacuum" it generate a new datafile, with a new unique name and
delete the old one. This confuse the stream clone code and create the same kind
of crash we were seeing in the previous patch.
We build a test case where this happens. The next changeset will contains a fix
We can also notice that we are, wrongfully exchanging `undo.*` files that the
client will not be able to use. This will be dealt with soon.
Differential Revision: https://phab.mercurial-scm.org/D10480
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 20:24:13 +0200] rev 46987
nodemap: add a test about racy commit during stream clone
That test show that the resulting client nodemap is different from the server
one. This happens because the server one transferred a corrupted node map. The
data file match the pre-commit content while the docket has post commit content.
As the result the nodemap was detected invalid and recomputed.
When running without the rust implementation, the code is also generating a new
datafile unconditionally, This mean the older file is no longer there are
transfer time, resulting in a crash.
We will fix this issue later, but we start with writing tests highlighting the
issue.
Differential Revision: https://phab.mercurial-scm.org/D10479
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 19:12:28 +0200] rev 46986
streamclone: remove sleep based "synchronisation" in tests
Sleep based test synchronisation does not work.
Variation in machine performance and load can make the two process miss their
windows. Instead we migrate to explicit signaling through the file system as
other tests file are using.
Differential Revision: https://phab.mercurial-scm.org/D10478
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 19:10:49 +0200] rev 46985
testing: add a `write_file` function
The function is kinda trivial, but having a simple function avoid silly mistake.
Differential Revision: https://phab.mercurial-scm.org/D10477
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 19:10:18 +0200] rev 46984
testing: add a utility function to wait for file create
This is similar to `tests/testlib/wait-on-file`, but for the python code
Differential Revision: https://phab.mercurial-scm.org/D10476
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 19:09:18 +0200] rev 46983
streamclone: check the errors log in tests
Code can be buggy, in that case having error message tend to help.
Differential Revision: https://phab.mercurial-scm.org/D10475
Matt Harbison <matt_harbison@yahoo.com> [Tue, 20 Apr 2021 00:23:56 -0400] rev 46982
mail: use a context manager when writing to mbox
Differential Revision: https://phab.mercurial-scm.org/D10484
Martin von Zweigbergk <martinvonz@google.com> [Mon, 19 Apr 2021 21:31:24 -0700] rev 46981
errors: remove unnecessary varargs handling from OutOfBandError
In my recent D10465, I moved some code over from scmutil into
`OutOfBandError.__init__`. The code was written to deal with an
arbitrary number of `message` arguments to the constructor. It turns
out that we only ever pass 0 or 1. Given that, let's simplify it.
Differential Revision: https://phab.mercurial-scm.org/D10483
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 11:10:16 +0200] rev 46980
phab-refresh: use a special comment on the stable branch
Phabricator make it hard to spot the branch information. As a result patch
intended for stable are consistently queued for default.
We add a special command and flashy GIF to try to attract reviewer attention on
the fact patch are intended for stable.
Differential Revision: https://phab.mercurial-scm.org/D10464
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 19 Apr 2021 11:04:11 +0200] rev 46979
phab-refresh: extract the comment in a variable
This make the script more readable and it is about to become more complex.
Differential Revision: https://phab.mercurial-scm.org/D10463
Martin von Zweigbergk <martinvonz@google.com> [Mon, 19 Apr 2021 16:53:45 -0700] rev 46978
tests: make test-archive.t pass on py3.9 (
issue6504)
Something got stricter at parsing URL query parameters and now the
parameters need to be separated by "&"; ";" is no longer allowed. See
issue6504 for details.
Differential Revision: https://phab.mercurial-scm.org/D10472
Martin von Zweigbergk <martinvonz@google.com> [Mon, 19 Apr 2021 12:52:23 -0700] rev 46977
errors: raise RemoteError in some places in exchange.py
This is part of https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan
Differential Revision: https://phab.mercurial-scm.org/D10467
Martin von Zweigbergk <martinvonz@google.com> [Mon, 19 Apr 2021 09:37:01 -0700] rev 46976
errors: introduce a class for remote errors
Having an exception for remote errors makes it much easier to exit
with the right detailed exit code.
Differential Revision: https://phab.mercurial-scm.org/D10466
Martin von Zweigbergk <martinvonz@google.com> [Mon, 19 Apr 2021 10:49:15 -0700] rev 46975
errors: make OutOfBandError extend Abort
I'm about to create a new `RemoteError` exception and make
`OutOfBandError` extend it. This patch prepares for that.
Differential Revision: https://phab.mercurial-scm.org/D10465
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:22:25 +0200] rev 46974
revlog: replace revlog._io.size with a new revlog.index.entry_size
The `revlogio` class is mostly a relic from the past. Once in charge of the full
revlog related Input/Output code, that class gradually lost responsibilities to
the point where more IO are now done by `revlog.index` objects or revlog objects
themself. I would like to ultimately remove the `revlogio` class, to do so I
start simple with move the "entry size" information on the index. (The index is
already responsible of the binary unpacking, so it knows the size.
Differential Revision: https://phab.mercurial-scm.org/D10309
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 20:32:53 +0200] rev 46973
perf-discovery: use `get_unique_pull_path`
This performance command now use the new API, unless the benchmarked Mercurial
is older.
Differential Revision: https://phab.mercurial-scm.org/D10423
Aay Jay Chan <aayjaychan@itopia.com.hk> [Wed, 14 Apr 2021 00:38:25 +0800] rev 46972
help: clarify when `$HG_URL` and `$HG_SOURCE` are added in hooks
Differential Revision: https://phab.mercurial-scm.org/D10400
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 15:39:00 +0200] rev 46971
nodemap: deal with data mmap error
If the file is too small, the mmapread call would raise a ValueError. We catch
that and ignore nodemap content (as we do without mmap). This make the repository
slightly slower (until the next write) but usable. Unlike the current crash.
Differential Revision: https://phab.mercurial-scm.org/D10458
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 14:59:13 +0200] rev 46970
nodemap: test various corruption scenario for the persistent nodemap
Corruption can happens in the wild, either because some of our code is buggy or
because repository were shared/transfered in a strange manners.
Currently one of the corruption case (not enough data) lead to a crash. We add
explicit tests for theses cases.
Differential Revision: https://phab.mercurial-scm.org/D10457
Matt Harbison <matt_harbison@yahoo.com> [Sat, 17 Apr 2021 00:28:21 -0400] rev 46969
cmdutil: fix an uninitialize variable usage in clearunfinished()
I happened to notice that PyCharm flagged this while looking for something else.
I'm pretty sure it meant to check the current state in the iteration, and not
keep reusing the last one in the previous iteration.
Differential Revision: https://phab.mercurial-scm.org/D10459
Aay Jay Chan <aayjaychan@itopia.com.hk> [Mon, 05 Apr 2021 14:19:17 +0800] rev 46968
help: document `$HG_NEW_OBSMARKERS` in pretxnclose hook
Differential Revision: https://phab.mercurial-scm.org/D10399
Aay Jay Chan <aayjaychan@itopia.com.hk> [Thu, 01 Apr 2021 22:43:55 +0800] rev 46967
help: prepend environment variables used in hooks with "$"
Most of them have "$" prefix but some don't, so adding it for consistency.
Differential Revision: https://phab.mercurial-scm.org/D10398
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 09:59:12 +0200] rev 46966
revset: drop an outdated comment
There is not `ui.expandpath` call there anymore.
Differential Revision: https://phab.mercurial-scm.org/D10435
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 01:03:12 +0200] rev 46965
ui: deprecated `ui.expandpath`
This function return a single path, something incompatible with the coming
change to `[paths]` definition to allow multiple associated urls.
Now that all user got migrated, we deprecate the function.
Differential Revision: https://phab.mercurial-scm.org/D10432
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:29:27 +0200] rev 46964
urlutil: remove usage of `ui.expandpath` in `get_clone_path`
We want to deprecate `ui.expandpath` and simplify the code before adding more
complexity in the form of `[paths]` entry pointing to multiple url. So we inline
the relevant bits.
Differential Revision: https://phab.mercurial-scm.org/D10431
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:27:00 +0200] rev 46963
urlutil: remove usage of `ui.expandpath` in `get_unique_pull_path`
We want to deprecate `ui.expandpath` and simplify the code before adding more
complexity in the form of `[paths]` entry pointing to multiple url. So we inline
the relevant bits.
Differential Revision: https://phab.mercurial-scm.org/D10430
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:20:58 +0200] rev 46962
urlutil: remove usage of `ui.expandpath` in `get_pull_paths`
We want to deprecate `ui.expandpath` and simplify the code before adding more
complexity in the form of `[paths]` entry pointing to multiple url. So we inline
the relevant bits.
Differential Revision: https://phab.mercurial-scm.org/D10429
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:15:53 +0200] rev 46961
debugbackupbundle: use `get_unique_pull_path`
This is the last known user of `ui.expandpath` outside of `urlutil`. Hooray.
Differential Revision: https://phab.mercurial-scm.org/D10428
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:15:22 +0200] rev 46960
debugssl: use `get_unique_pull_path`
Let's move this code to the new API.
Differential Revision: https://phab.mercurial-scm.org/D10427
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:11:39 +0200] rev 46959
debugdiscovery: use `get_unique_pull_path`
Lets move this code to the new API.
Differential Revision: https://phab.mercurial-scm.org/D10426
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 21:02:38 +0200] rev 46958
profiling: use `util.expandpath` instead of `ui.expandpath` for output
Given we are talking about the path to an output file, I am fairly certain that
the initial author meant to expand `~` and the like and not to resolve entry
from `[paths]`.
Differential Revision: https://phab.mercurial-scm.org/D10425
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 20:57:34 +0200] rev 46957
dispatch: use the new API to resolve --repository
An even weirder feature of Mercurial is the ability to use `[paths]` alias as
value of `--repository`. The weird feature now use the new APIs.
Differential Revision: https://phab.mercurial-scm.org/D10424
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 20:21:11 +0200] rev 46956
revset: use `get_unique_pull_path` for `remote(…)`
This one is also resolving path. For now we restrict the feature to a single
destination. This might change in the future.
Differential Revision: https://phab.mercurial-scm.org/D10422
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 20:15:09 +0200] rev 46955
remotefilelog: use `get_unique_pull_path` in `getflogheads`
Another command moved to the new API, hooray.
Differential Revision: https://phab.mercurial-scm.org/D10421
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 19:30:48 +0200] rev 46954
summary: use the new APIs
Summary can perform some incoming/outgoing queries (that should be common to the
other command with the same needs, but that is another story).
We now use the new APIs to do so. The current code behavior is a bit fishy,
relying to the fact "default" will be picked as the destination in last resort.
I did not altered that, but left various comment to highlight the issue.
Differential Revision: https://phab.mercurial-scm.org/D10420
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 18:37:29 +0200] rev 46953
share: use `get_clone_path`
Since `hg share` is mostly like clone, do the same changes there.
Differential Revision: https://phab.mercurial-scm.org/D10419
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 18:02:25 +0200] rev 46952
init: use `get_clone_path` when suitable
`hg init` has this weird feature were you can refer to `[paths]` entry select the path to initialize. We move that code to the new APIs.
Differential Revision: https://phab.mercurial-scm.org/D10418
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 18:34:42 +0200] rev 46951
clone: use `get_clone_path`
"Surprisingly", the new API is well suited for `hg clone` too.
Differential Revision: https://phab.mercurial-scm.org/D10417
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 17:41:02 +0200] rev 46950
incoming: kill the `repo._subtoppath =` hack
We do the same as for `hg outgoing`, instead of relying on implicit passing
value by monkey punching them onto the repo object, we pass equivalent
information by argument to the proper function.
This is way cleaner.
Differential Revision: https://phab.mercurial-scm.org/D10416
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 17:29:27 +0200] rev 46949
identify: use `get_unique_pull_path`
The command only support a single destination. We use the associated API.
Differential Revision: https://phab.mercurial-scm.org/D10415
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 17:02:20 +0200] rev 46948
bundle: support multiple destinations
`hg outgoing` and `hg push` now support multiple destination. We do the same
for `hg bundle`. Various other commands needs this kind of behavior and it
would be create to factor this code out for their usage. However this is an
adventure for another time.
They are some minor change to the tests (in addition to the new test for the
feature):
* one because I updated a message to plurals,
* another one because the error changed, and I actually find it clearer.
Differential Revision: https://phab.mercurial-scm.org/D10414
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 14:35:13 +0200] rev 46947
lfs: use the new APIs
The part of the lfs store that requires a destination cannot operate on multiple destination (yet). So we move them to the dedicated APIs.
Differential Revision: https://phab.mercurial-scm.org/D10413
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 13:06:09 +0200] rev 46946
fastannotate: use `get_unique_pull_path`
The code does not support multiple destination yet, so lets move it to the
dedicated API.
Differential Revision: https://phab.mercurial-scm.org/D10412
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 12:57:55 +0200] rev 46945
remotefilelog: use the right expandpath in to expand `~`
Given the context where path is most likely a file system path, I suspect that
the initial author confused ui.expandpath and util.expandpath (a proxy for
os.path.expanduser and co)
Differential Revision: https://phab.mercurial-scm.org/D10411
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 10:46:56 +0200] rev 46944
transplant: use `get_unique_pull_path`
The command does not support multiple destination (yet).
Differential Revision: https://phab.mercurial-scm.org/D10410
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 10:46:52 +0200] rev 46943
infinitepush: use `get_unique_pull_path`
The extension does not support multiple destination (yet).
Differential Revision: https://phab.mercurial-scm.org/D10456
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 12:29:44 +0200] rev 46942
relink: use `get_unique_pull_path`
The code does not support multiple destination and will probably never do so.
So lets use the dedicated API for this case.
Differential Revision: https://phab.mercurial-scm.org/D10409
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 12:01:27 +0200] rev 46941
histedit: use `get_unique_push_path`
Same as for `pathbomb`, this code does not support multiple destinations yet. It might in the future, probably with code put in common with patchwork, but for now lets use the dedicated API.
Differential Revision: https://phab.mercurial-scm.org/D10408
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 11:57:20 +0200] rev 46940
urlutil: add a new `get_unique_push_path`
This function is dedicated to call that needs a single destination. Currently
most caller actually need that since few actually support multiple destinations
(the most importants `hg push` and `hg outgoing` do). So having a clear API
point for that will be important when the time comes to have a single `[paths]`
alias resolving to multiple urls.
Differential Revision: https://phab.mercurial-scm.org/D10407
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 11:38:10 +0200] rev 46939
fetch: use `get_unique_pull_path` to retrieve the path
The fetch command does not support multiple destination, so we use the new dedicated API for that.
Differential Revision: https://phab.mercurial-scm.org/D10406
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 11:30:49 +0200] rev 46938
patchbomb: use `get_unique_pull_path`
The patchbomb code does not support multiple destinations yet. It would not be
too hard to implemented since `hg outgoing` does. However that is a bit too
much of a detour right now. In addition that kind of "select outgoing
changesets for processing" code exist for various commands so the best would be
to factor it out later.
Let us use the dedicated API until this is solved.
This comes with a small output change in the test that I find more accurate. So
I kept it.
Differential Revision: https://phab.mercurial-scm.org/D10405
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 11:18:48 +0200] rev 46937
narrow: use `get_unique_pull_path`
The narrow's `tracked` command does not support multiple destination, lets use
the dedicated API then.
Differential Revision: https://phab.mercurial-scm.org/D10404
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 11:15:54 +0200] rev 46936
urlutil: add a new `get_unique_pull_path`
This function is dedicated to call that needs a single destination. Currently most caller actually need that since few actually support multiple destinations (the most importants `hg push` and `hg outgoing` do). So having a clear API point for that will be important when the time comes to have a single `[paths]` alias resolving to multiple urls.
Differential Revision: https://phab.mercurial-scm.org/D10403
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 10:51:31 +0200] rev 46935
mq: use the new `get_clone_path` to get the remote url
We stop using `ui.expandpath` to use a function with a more defined semantic. This will help us to make it an option to point [paths] entry to multiple destination.
Differential Revision: https://phab.mercurial-scm.org/D10402
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 10:35:40 +0200] rev 46934
urlutil: add a `get_clone_path` function
We add a new function with a semantic focussed on `clone` operation (so without
an existing repository). I am not certain the return type is the best, but this
is what we need for now. Once all caller are migrated we might start thinking
about that the API should be. For now that will do.
Differential Revision: https://phab.mercurial-scm.org/D10401
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 19:18:54 +0200] rev 46933
outgoing: use `get_push_paths` in the revset too
The revsets now use the same code as everyone and is ready for entry in
`[paths]` pointing to multiple entries.
Differential Revision: https://phab.mercurial-scm.org/D10393
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 02:14:15 +0200] rev 46932
incoming: use `urlutil.get_pull_paths`
Lets use the new method to increase code reuse. However I did not implement
support for multiple source yet. It would be possible create multiple temporary
bundle, but that is a bit too much work outside of my current route to make the
detour.
Differential Revision: https://phab.mercurial-scm.org/D10392
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 01:26:44 +0200] rev 46931
outgoing: accept multiple destinations
This align the behavior of `hg outgoing` with the one of `hg incoming`. In addition this prepare the introduction of having simple `path` resolve to multiple destination in practice (eg: `default`)
Differential Revision: https://phab.mercurial-scm.org/D10391
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 09:23:28 +0200] rev 46930
outgoing: pass subrepo path using function argument instead of abssource hack
This is clearer, remove the needs for the `repo._subtoppath` hack and will make
our live easier when making `outgoing` accept multiple destinations.
Differential Revision: https://phab.mercurial-scm.org/D10390
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 09:23:19 +0200] rev 46929
subrepo: introduce a `repo_rel_or_abs_source` function
The `subrepoutil` module has various function to compute the path of a
sub-repository compared to the root of the top repository. However, they was no
function available to compute the relative path of the repository "source". And
we need this information for exchange operation (in our case, `hg outgoing`).
The information is currently build using the `repo._subtoppath` hack. We reuse
the same logic but in a dedicated function independent of the `repo._subtoppath`
hack.
Differential Revision: https://phab.mercurial-scm.org/D10434
Matt Harbison <matt_harbison@yahoo.com> [Wed, 14 Apr 2021 22:50:41 -0400] rev 46928
urlutil: use bytes for Abort messages
Caught by pytype. Also fix a minor grammar issue in the second message.
Differential Revision: https://phab.mercurial-scm.org/D10433
Raphaël Gomès <rgomes@octobus.net> [Thu, 08 Apr 2021 16:41:13 +0200] rev 46927
changegroup: update comment
Gratuitous fix, I stumbled upon this comment while reading code.
Differential Revision: https://phab.mercurial-scm.org/D10339
Matt Harbison <matt_harbison@yahoo.com> [Mon, 12 Apr 2021 23:31:54 -0400] rev 46926
re2: adjust local variable assignment scope
Pytype flagged the exception handler where these are used as `[name-error]`, and
PyCharm complained they may be used before assignment.
Differential Revision: https://phab.mercurial-scm.org/D10376
Simon Sapin <simon.sapin@octobus.net> [Sat, 13 Mar 2021 09:50:34 +0100] rev 46925
rhg: Make `files` work on repo-relative paths when possible
When the current directory is outside of the repository we need to turn
everything into absolute filesystem paths in order to compute correct
relative paths.
This was previously done unconditionally, but is not necessary when
the current directory is inside the repository.
With this change `rhg files > /dev/null` at the root of a mozilla-central
snapshot goes from ~150 ms to ~70 ms. My repository is located at a
somewhat long path though (93 bytes). The effect may not be as pronounced
at a shorter path.
Differential Revision: https://phab.mercurial-scm.org/D10200
Kyle Lippincott <spectral@google.com> [Mon, 12 Apr 2021 19:25:34 -0700] rev 46924
split: avoid strip if split is a no-op (identical to original)
Differential Revision: https://phab.mercurial-scm.org/D10389
Kyle Lippincott <spectral@google.com> [Mon, 12 Apr 2021 17:52:46 -0700] rev 46923
split: fix issue with empty splits adjusting phases
Differential Revision: https://phab.mercurial-scm.org/D10388
Kyle Lippincott <spectral@google.com> [Mon, 12 Apr 2021 17:51:56 -0700] rev 46922
split: add test demonstrating issue with empty splits adjusting phases
Differential Revision: https://phab.mercurial-scm.org/D10387
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 16:09:12 +0200] rev 46921
test-lfs: fix expected output
This is not covered by the CI and was broken.
Differential Revision: https://phab.mercurial-scm.org/D10397
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 15:56:21 +0200] rev 46920
test-lfs: avoid a bashism when spawning the server
For zsh, this &> call is read as "& >", this spin the process without
redirection. As a result the server grab stdout, which does not get closed at the
end of the test. As a result `run-tests.py` hang there forever, waiting for the
the stream for be close. (which is probably as issue on its own).
Differential Revision: https://phab.mercurial-scm.org/D10396
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 15:54:32 +0200] rev 46919
test-lfs: avoid pagination
Otherwise, the pagination can trigger in when running the test with --debug,
blocking the test execution for no good reason.
Differential Revision: https://phab.mercurial-scm.org/D10395
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Apr 2021 15:53:43 +0200] rev 46918
run-test: make it clearer why we terminating process
The --verbose log wer only talking about process termination. Now we have more
information about why.
Differential Revision: https://phab.mercurial-scm.org/D10394
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Apr 2021 15:30:32 +0200] rev 46917
push-dests: move the code around missing default dest inside `get_push_paths`
This function has a clear semantic and moving the code dealing with this inside
it will help reduce duplication.
Differential Revision: https://phab.mercurial-scm.org/D10385
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Apr 2021 15:32:59 +0200] rev 46916
push-dests: rework the handling of default value
This new core is more straightforward and doing this early will make the next
changeset simpler.
Differential Revision: https://phab.mercurial-scm.org/D10384
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 20:00:46 +0200] rev 46915
outgoing: merge the code handling --graph with the main one
The --graph code had its own copy of the logic. With the previous reorganisation
of the code, we can now merge it with the main code, reducing fragile
complication.
As a side effect, `hg out --graph` now use the right return code when they are
nothing outgoing. This explain the change to output in
`tests/test-largefiles-misc.t`.
Differential Revision: https://phab.mercurial-scm.org/D10383
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Apr 2021 15:13:20 +0200] rev 46914
outgoing: move filtering logic in its own function
This move code dedicated to a single purpose together and make the main code
simpler. Right when we are getting ready to make it more complex :-D
Differential Revision: https://phab.mercurial-scm.org/D10382
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 19:31:03 +0200] rev 46913
outgoing: make `recurse` a real function
If we want to use this in a loop, we need to be able to pass argument.
Differential Revision: https://phab.mercurial-scm.org/D10381
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 19:20:14 +0200] rev 46912
outgoing: remove some early return
Since
066b8d8f75b8, the push command accept multiple destination. However `hg
outgoing` does not. On the way to fix this, we need to clean up the outgoing
code. We start with removing some early return to make the code ready to house
more changes.
Differential Revision: https://phab.mercurial-scm.org/D10380
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 10 Apr 2021 21:55:01 +0200] rev 46911
infinitepush: use the new function to determine push destination
Since
066b8d8f75b8, the push command accept multiple destination. `infinitepush`
was not aware of that. We now use the new `urlutil.get_push_paths` function to
determine the push destination, fixing the issue. This will also make future
evolution of that logic transparent for infinitepush
We still disallow push to multiple destinations if infinite push is enabled
because I don't know what this means for infinite push. However user will now
get a clear error message instead of a crash.
Differential Revision: https://phab.mercurial-scm.org/D10379
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Apr 2021 12:28:44 +0200] rev 46910
urlutil: add a `get_pull_paths` to perform the pull destination logic
As is this changeset does not change anything. However having an official empty
point will help unifying the logic and encapsulate the details and update the
logic to support path definition pointing to multiple other path.
Differential Revision: https://phab.mercurial-scm.org/D10378
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 12 Apr 2021 22:22:56 +0200] rev 46909
urlutil: add a `get_push_paths` to perform the push destination logic
As is this changeset does not change anything. However having an official empty
point will help unifying the logic and encapsulate the details and update the
logic to support path definition pointing to multiple other path.
Differential Revision: https://phab.mercurial-scm.org/D10377
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 12 Apr 2021 06:34:54 +0200] rev 46908
urlutil: extract `parseurl` from `hg` into the new module
The new module is well fitting for this new code. And this will be useful to
make the gathered code collaborate more later.
Differential Revision: https://phab.mercurial-scm.org/D10375
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 12 Apr 2021 03:01:04 +0200] rev 46907
urlutil: extract `url` related code from `util` into the new module
The new module is well fitting for this new code. And this will be useful to
make the gathered code collaborate more later.
Differential Revision: https://phab.mercurial-scm.org/D10374
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 23:54:35 +0200] rev 46906
urlutil: extract `path` related code into a new module
They are a lot of code related to url and path handling scattering into various
large module. To consolidate the code before doing more change (for defining
"multi-path"), we gather it together.
Differential Revision: https://phab.mercurial-scm.org/D10373
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 10 Apr 2021 15:30:32 +0200] rev 46905
help: document the `path://` url scheme
If we want people to use it, we need to document it.
Differential Revision: https://phab.mercurial-scm.org/D10372
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 10 Apr 2021 15:28:10 +0200] rev 46904
help: point to `hg help urls` in `hg help config.paths`
This seems useful to point at what people can put as value for these config.
Differential Revision: https://phab.mercurial-scm.org/D10371
Matt Harbison <matt_harbison@yahoo.com> [Mon, 12 Apr 2021 22:42:47 -0400] rev 46903
merge with stable
Charles Chamberlain <cchamberlain@janestreet.com> [Fri, 09 Apr 2021 17:41:48 -0400] rev 46902
narrow: add capabilities for local repos, not just remote peers
This fixes the bug where running `hg clone --narrow ./local-repo`
fails with
abort: server does not support narrow clones
even when the server has narrow enabled.
Differential Revision: https://phab.mercurial-scm.org/D10357
Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Mar 2021 22:29:41 -0400] rev 46901
typing: make minor adjustments to mercurial/util.py to pass pytype checking
I'm assuming the wrong-arg-count is a pytype bug, because this code is used by
the config object. Avoiding initializing `_lrucachenode` node points to None
eliminates a few `is not None` assertions, but apparently not all of them. I
can't figure out why it gets confused over the state where these new assertions
are.
Differential Revision: https://phab.mercurial-scm.org/D10276
Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Mar 2021 20:22:00 -0400] rev 46900
util: fix the signature for the pypy override of sortdict.update()
PyCharm flagged this as not matching the base class signature. Not sure if
there was anything supplying these extra arguments though.
Differential Revision: https://phab.mercurial-scm.org/D10275
Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Mar 2021 18:59:14 -0400] rev 46899
typing: add type hints to mercurial/error.py
The only slightly unusual things here are that `location` is passed to
`ParseError` and both bytes and an int (so this accepts both), and the message
passed `ProgrammingError` is immediately converted to str. Therefore it is
typed as `AnyStr`, because there are a couple of instances that are already
passed as str.
There are a couple of places where bytes are being passed to builtin exceptions
that might need to be converted to str.
Differential Revision: https://phab.mercurial-scm.org/D10274
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Mar 2021 00:36:26 -0400] rev 46898
tests: add a (very slow) test that executes pytype
This is an updated form of D7295, and completes successfully with pytype
2021.03.22. The 5 or so crashes that were mostly in the hgweb files seems to
have been fixed in 2021.03.10.
Differential Revision: https://phab.mercurial-scm.org/D10237
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 10:38:27 +0200] rev 46897
upgrade: do not hardcore file extension of revlogs
This logic already lives inside the `store` module. So lets reuse it instead.
Differential Revision: https://phab.mercurial-scm.org/D10317
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 10:38:11 +0200] rev 46896
upgrade: take advantage of the new information returned by `store.walk`
Before this change the upgrade code had to analyse filename to process them directly. Lets keep that logic private to the store and more to a more robust explicit approach.
Differential Revision: https://phab.mercurial-scm.org/D10316
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 10:38:03 +0200] rev 46895
store: also return some information about the type of file `walk` found
We start returning of 4th information in the `store.walk` return tuple: the type of the file. This will make it easier for caller to determine which kind of file they are looking at. This should especically help with the `upgrade-repo` code that has to do a lot of fragile index's file name comparison.
Differential Revision: https://phab.mercurial-scm.org/D10315
Matt Harbison <matt_harbison@yahoo.com> [Mon, 05 Apr 2021 23:54:54 -0400] rev 46894
tests: skip test-git-interop.t on Windows
Casefolding isn't handled in dirstate yet, triggering a bunch of assertions.
But while this is more correctly `no-icasefs`, it's more likely to get attention
if someone sees it. I'd just rather not have it adding to the noise on Windows
for now.
Differential Revision: https://phab.mercurial-scm.org/D10312
Matt Harbison <matt_harbison@yahoo.com> [Mon, 05 Apr 2021 13:02:51 -0400] rev 46893
contrib: restore the `hg fix` configuration in the examples
After
decc3bd3f20d, running `black` will DTRT, but running `hg fix` did nothing
(unless the example config file was %included, in which case it truncated the
file instead of formatting it). I'm not sure why that was happening, but let's
not leave a code shredder laying around.
Differential Revision: https://phab.mercurial-scm.org/D10311
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Wed, 31 Mar 2021 17:54:02 -0400] rev 46892
blackbox: fix type error on log rotation on read-only filesystem
Grepping around, the code uses either encoding.strtolocal or
stringutil.forcebytestr in this situation. No idea which is best.
Differential Revision: https://phab.mercurial-scm.org/D10293
Simon Sapin <simon.sapin@octobus.net> [Thu, 08 Apr 2021 14:38:27 +0200] rev 46891
rust: Remove use of `py.eval()`
The previous Rust code allocated an intermediate `Vec`, converted that
to a Python list, then used `eval` to run Python code that converts that
list to a Python set.
rust-cpython exposes Rust bindings for Python sets, let’s use that instead
to construct a set directly.
Differential Revision: https://phab.mercurial-scm.org/D10328
Simon Sapin <simon.sapin@octobus.net> [Thu, 08 Apr 2021 21:46:54 +0200] rev 46890
rust: Remove the compile-time 'dirstate-tree' feature flag
This code has compiler errors since it is not built on CI and nobody has been
working on it for some time.
We (Octobus) are still pursuing status optimizations based on a tree data
structure for the dirstate, but upcoming patches will use a run-time opt-in
instead of compile-time, so that at least corresponding Rust code keeps
compiling when other changes are made.
Differential Revision: https://phab.mercurial-scm.org/D10329
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Sun, 13 Sep 2020 22:14:25 -0400] rev 46889
procutil: avoid using os.fork() to implement runbgcommand
We ran into the following deadlock:
- some command creates an ssh peer, then raises without explicitly
closing the peer (hg id + extension in our case)
- dispatch catches the exception, calls ui.log('commandfinish', ..)
(the sshpeer is still not closed), which calls logtoprocess, which
calls procutil.runbgcommand.
- in the child of runbgcommand's fork(), between the fork and the
exec, the opening of file descriptors triggers a gc which runs the
destructor for sshpeer, which waits on ssh's stderr being closed,
which never happens since ssh's stderr is held open by the parent of
the fork where said destructor hasn't run
Remotefilelog appears to have a hack around this deadlock as well.
I don't know if there's more subtlety to it, because even though the
problem is determistic, it is very fragile, so I didn't manage to
reduce it.
I can imagine three ways of tackling this problem:
1. don't run any python between fork and exec in runbgcommand
2. make the finalizer harmless after the fork
3. close the peer without relying on gc behavior
This commit goes with 1, as forking without exec'ing is tricky in
general in a language with gc finalizers. And maybe it's better in the
presence of rust threads. A future commit will try 2 or 3.
Performance wise: at low memory usage, it's an improvement. At higher
memory usage, it's about 2x faster than before when ensurestart=True,
but 2x slower when ensurestart=False. Not sure if that matters. The
reason for that last bit is that the subprocess.Popen always waits for
the execve to finish, and at high memory usage, execve is slow because
it deallocates the large page table. Numbers and script:
before after
mem=1.0GB, ensurestart=True 52.1ms 26.0ms
mem=1.0GB, ensurestart=False 14.7ms 26.0ms
mem=0.5GB, ensurestart=True 23.2ms 11.2ms
mem=0.5GB, ensurestart=False 6.2ms 11.3ms
mem=0.2GB, ensurestart=True 15.7ms 7.4ms
mem=0.2GB, ensurestart=False 4.3ms 8.1ms
mem=0.0GB, ensurestart=True 2.3ms 0.7ms
mem=0.0GB, ensurestart=False 0.8ms 0.8ms
import time
for memsize in [1_000_000_000, 500_000_000, 250_000_000, 0]:
mem = 'a' * memsize
for ensurestart in [True, False]:
now = time.time()
n = 100
for i in range(n):
procutil.runbgcommand([b'true'], {}, ensurestart=ensurestart)
after = time.time()
ms = (after - now) / float(n) * 1000
print(f'mem={memsize / 1e9:.1f}GB, ensurestart={ensurestart} -> {ms:.1f}ms')
Differential Revision: https://phab.mercurial-scm.org/D9019
Matt Harbison <matt_harbison@yahoo.com> [Thu, 08 Apr 2021 18:43:08 -0400] rev 46888
share: store relative share paths with '/' separators
I created a relative share in Windows and tried to use it in WSL, and it failed:
abort: .hg/sharedpath points to nonexistent directory
/mnt/c/Users/Matt/hg-review/.hg/..\..\hg\.hg
Use `normpath` on the read side so that the code has the usual Windows style
paths it always had (I don't think that matters much), but it also eliminates
the directory escaping path components in the case where the path is printed.
This will not fix repositories that have already been created, but it's trivial
enough to hand edit the file to correct it.
Differential Revision: https://phab.mercurial-scm.org/D10330
Simon Sapin <simon.sapin@octobus.net> [Fri, 09 Apr 2021 12:02:51 +0200] rev 46887
unit-tests: Fix `cargo test` on 32-bit platforms
Fixes https://bz.mercurial-scm.org/show_bug.cgi?id=6506
This makes `IndexEntryBuilder::build`, which is only used in unit tests, use
`u32` or `u64` instead of platform-dependent `usize` when packing binary data
to be used at test input.
To run Rust unit tests in 32-bit mode in a x86-64 environment, use:
rustup target add i686-unknown-linux-gnu # Once
(cd rust && cargo test --target i686-unknown-linux-gnu)
Differential Revision: https://phab.mercurial-scm.org/D10351
Martin von Zweigbergk <martinvonz@google.com> [Fri, 09 Apr 2021 08:46:40 -0700] rev 46886
rename: add --forget option and stop suggesting `hg revert` for undoing
Differential Revision: https://phab.mercurial-scm.org/D10355
Matt Harbison <matt_harbison@yahoo.com> [Fri, 09 Apr 2021 11:32:19 -0400] rev 46885
win32: enable legacy I/O mode to fix missing pager output on Windows with py3
The equivalent interpreter option is set by wrapper.exe, but this *.bat file is
what gets installed in a venv. Without this mode, any command that spins up a
pager has no output, unless the pager is explicitly disabled. The variable is
set inside the `setlocal` scope to keep it from leaking into the environment
after the bat file exits.
We should probably still figure out how to ship a compiled hg.exe when
installing with `pip`, because the binary does other things like enable long
filename support. But this avoids the dangerous and confusing lack of output in
the meantime.
Differential Revision: https://phab.mercurial-scm.org/D10354
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 14 Jan 2021 04:58:20 +0100] rev 46884
persistent-nodemap: enable the feature by default when using Rust
As discussed at the 5.6 sprint, we can make it enabled by default, but only for
Rust installation.
Differential Revision: https://phab.mercurial-scm.org/D9765
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:36:24 +0200] rev 46883
persistent-nodemap: disable it for test-wireproto-content-redirects.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10338
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:30:18 +0200] rev 46882
persistent-nodemap: disable it for test-wireproto-command-capabilities.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10337
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:36:07 +0200] rev 46881
persistent-nodemap: disable it unconditionally for test-wireproto-caching.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10336
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:51:25 +0200] rev 46880
persistent-nodemap: disable it unconditionally for test-ssh-proto-unbundle.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10335
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:51:35 +0200] rev 46879
persistent-nodemap: disable it unconditionally for test-ssh-proto.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10334
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 04:13:07 +0200] rev 46878
persistent-nodemap: disable it unconditionally for test-share-safe.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10333
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:44:45 +0200] rev 46877
persistent-nodemap: disable it unconditionally for test-http-protocol.t
This is not relevant for the test and this will avoid a lot of variations.
Differential Revision: https://phab.mercurial-scm.org/D10332
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 03:15:07 +0200] rev 46876
persistent-nodemap: disable it unconditionally for test-http-bad-server.t
This is not relevant for the test and this will avoid a lot of variations
Differential Revision: https://phab.mercurial-scm.org/D10331
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 08 Apr 2021 20:05:59 +0200] rev 46875
clang-format: run the formatter on mercurial/cext/revlog.c
This fix `test-check-clang-format.t` that has been complaining for a while.
Differential Revision: https://phab.mercurial-scm.org/D10327
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 18:55:19 +0200] rev 46874
revlog-compression: use zstd by default (if available)
As see in changeset
bb271ec2fbfb, zstd is 20% to 50% faster for reading and
writing.
Use take advantage of the new config behavior to try zstd by default, falling
back to zlib is zstd is not available on that plateform.
Differential Revision: https://phab.mercurial-scm.org/D10326
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Apr 2021 13:31:15 +0200] rev 46873
rhg: make rhg recognise it supports zstd compression for revlogs
It already did, but was not aware of it.
Differential Revision: https://phab.mercurial-scm.org/D10324
Kyle Lippincott <spectral@google.com> [Wed, 31 Mar 2021 12:46:54 -0700] rev 46872
match: convert O(n) to O(log n) in exactmatcher.visitchildrenset
When using narrow, during rebase this is called (at least) once per directory in
the set of files in the commit being rebased. Every time it's called, we did the
set arithmetic (now extracted and cached), which was probably pretty cheap but
not necessary to repeat each time, looped over every item in the matcher and
kept things that started with the directory we were querying.
With very large narrowspecs, and a commit that touched a file in a large number
of directories, this was slow. In a pathological repo, the rebase of a single
commit (that touched over 17k files, I believe in approximately as many
directories) with a narrowspec that had >32k entries took 8,246s of profiled
time, with 5,007s of that spent in visitchildrenset (transitively). With this
change, the time spent in visitchildrenset is less than 34s (which is where my
profile cut off). Most of the remaining time was network access due to our
custom remotefilelog-based setup not properly prefetching.
Differential Revision: https://phab.mercurial-scm.org/D10294
Kyle Lippincott <spectral@google.com> [Tue, 30 Mar 2021 13:05:22 -0700] rev 46871
exthelper: improve docs to indicate what module vars are needed
I recently tried creating an extension "from scratch" using exthelper, and it
wasn't obvious that you needed these. I believe that a careful reading of one of
the comments would tell you that they were required, but it's easy to miss and
having the examples be "complete" is helpful.
Differential Revision: https://phab.mercurial-scm.org/D10295
Matt Harbison <matt_harbison@yahoo.com> [Mon, 05 Apr 2021 12:44:33 -0400] rev 46870
tests: restore the ability to run `black` on Windows
The hghave test for black silently stopped working with the change in
08fd76a553c9. This was the output of what it was hitting when run in the test
environment:
Traceback (most recent call last):\r (esc)
File "c:\\users\\matt\\appdata\\local\\programs\\python\\python39\\lib\\runpy.py", line 197, in _run_module_as_main\r (esc)
return _run_code(code, main_globals, None,\r (esc)
File "c:\\users\\matt\\appdata\\local\\programs\\python\\python39\\lib\\runpy.py", line 87, in _run_code\r (esc)
exec(code, run_globals)\r (esc)
File "c:\\Users\\Matt\\AppData\\Roaming\\Python\\Python39\\Scripts\\black.exe\\__main__.py", line 4, in <module>\r (esc)
File "C:\\Users\\Matt\\AppData\\Roaming\\Python\\Python39\\site-packages\\black\\__init__.py", line 70, in <module>\r (esc)
CACHE_DIR = Path(user_cache_dir("black", version=__version__))\r (esc)
File "C:\\Users\\Matt\\AppData\\Roaming\\Python\\Python39\\site-packages\\appdirs.py", line 293, in user_cache_dir\r (esc)
path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))\r (esc)
File "C:\\Users\\Matt\\AppData\\Roaming\\Python\\Python39\\site-packages\\appdirs.py", line 481, in _get_win_folder_with_pywin32\r (esc)
dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0)\r (esc)
pywintypes.com_error: (-
2147024893, '$ENOTDIR$.', None, None)\r (esc)
[1]
Differential Revision: https://phab.mercurial-scm.org/D10310
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Apr 2021 21:15:45 -0400] rev 46869
setup: copy python3.dll next to hg.exe when building on Windows for hgext.git
I thought I took care of this already, but it must have been that I just
manually copied the file over locally when debugging why the pygit2 library
wasn't loading. The problem with that is what was copied over was from py38,
and then running a py39 build hard crashed when the extension was loaded.
Differential Revision: https://phab.mercurial-scm.org/D10301
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Apr 2021 20:26:45 -0400] rev 46868
tests: stablize test-hook.t on Windows
Apparently, hooks can't run `echo` directly, even from MSYS.
Differential Revision: https://phab.mercurial-scm.org/D10300
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Apr 2021 20:25:37 -0400] rev 46867
tests: handle Windows file separator differences in test-config.t
Differential Revision: https://phab.mercurial-scm.org/D10299
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Apr 2021 15:02:09 -0400] rev 46866
tests: update the detailed exit codes for icasefs gated tests
The fact that there's already a detailed exit code after the last change here in
test-casecollision-merge.t gives me some pause, but maybe it was found and
changed manually?
Differential Revision: https://phab.mercurial-scm.org/D10298
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Apr 2021 15:00:20 -0400] rev 46865
tests: update the detailed exit codes in test-phabricator.t
I'm guessing this has slipped through because most people don't have the
necessary `pytest-vcr` package installed.
Differential Revision: https://phab.mercurial-scm.org/D10297
Martin von Zweigbergk <martinvonz@google.com> [Thu, 25 Mar 2021 15:38:31 -0700] rev 46864
tests: avoid using rebaseskipobsolete=0
I'm about to delete the `rebaseskipobsolete` config. This patch
updates a test to get hidden commits into the rebase state by using
`hg debugobsolete` instead of setting `rebaseskipobsolete=0`.
Differential Revision: https://phab.mercurial-scm.org/D10270
Martin von Zweigbergk <martinvonz@google.com> [Thu, 25 Mar 2021 11:35:16 -0700] rev 46863
rebase: when using --keep, don't care about pruned commits or divergence
`hg rebase --keep` creates duplicate commits (not successors), so I
was surprised that it still skips pruned commits and errors out if it
"would cause divergence" (it wouldn't). I guess this was just an
oversight. We didn't have any tests for it, so I also included that.
Differential Revision: https://phab.mercurial-scm.org/D10269
Martin von Zweigbergk <martinvonz@google.com> [Thu, 25 Mar 2021 08:38:16 -0700] rev 46862
rebase: remove duplicate initialization of a field
`obsolete_with_successor_in_destination` is already initialized in the
constructor.
Differential Revision: https://phab.mercurial-scm.org/D10268
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:22:12 +0200] rev 46861
rust: bump rust-cpython version to 0.5.2
we need a newer version to define "property" on Rust defined object.
Differential Revision: https://phab.mercurial-scm.org/D10308
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:21:58 +0200] rev 46860
revlog: directly use the Struct object for related operation
The Struct object has all the piece we needs, so no need to duplicate
information on the revlog itself.
Differential Revision: https://phab.mercurial-scm.org/D10307
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:21:23 +0200] rev 46859
revlog: move the "index header" struct inside revlog.utils.constants
The struct was previous called "version", but this is actually "version" +
"flags". So header seems like a better name.
The move to the `constants` module has the same motivation as the INDEX_ENTRY_V#
ones.
Differential Revision: https://phab.mercurial-scm.org/D10306
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:21:12 +0200] rev 46858
revlog: move the details of revlog "v2" index inside revlog.utils.constants
the revlog module is quite large and this kind of format information would handy
for other module. So let us start to gather this information about the format in
a more appropriate place.
We update various reference to this information to use the new "source of truth"
in the process.
Differential Revision: https://phab.mercurial-scm.org/D10305
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:21:01 +0200] rev 46857
revlog: move the details of revlog "v1" index inside revlog.utils.constants
The revlog module is quite large and this kind of format information would handy
for other module. So let us start to gather this information about the format in
a more appropriate place.
We update various reference to this information to use the new "source of truth"
in the process.
Differential Revision: https://phab.mercurial-scm.org/D10304
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:20:52 +0200] rev 46856
revlog: move the details of revlog "v0" index inside revlog.utils.constants
the revlog module is quite large and this kind of format information would handy
for other module. So let us start to gather this information about the format in
a more appropriate place.
Differential Revision: https://phab.mercurial-scm.org/D10303
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Apr 2021 12:20:40 +0200] rev 46855
revlog: add some comment in the header sections
We are about to add more content so let us organise the existing content first.
Differential Revision: https://phab.mercurial-scm.org/D10302
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 10:37:55 +0200] rev 46854
store: drop the `filefilter` argument to `_walk`
No code use it anywhere. Dropping it will help replacing the function with
something with a more precise semantic.
Differential Revision: https://phab.mercurial-scm.org/D10314
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 10:37:47 +0200] rev 46853
store: document the `walk` method
Differential Revision: https://phab.mercurial-scm.org/D10313
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 06 Apr 2021 13:49:19 -0400] rev 46852
revlog: fix error about unknown compression format in py3
In py2, the error is something like:
abort: unknown compression type 'x'!
In py3, we get the following unhelpful message:
abort: unknown compression type <memory at 0x
7f4650b5cdc8>!
Switch to something like:
abort: unknown compression type 78!
Differential Revision: https://phab.mercurial-scm.org/D10318
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Apr 2021 12:15:28 +0200] rev 46851
revlog-compression: fix computation of engine availability
We don't just need the engine to be define, we need it to be available and able
to do be used for revlog compression. Without this change, `zstd` could be
selected as a viable option for repository creation on platform where it is not
available.
Differential Revision: https://phab.mercurial-scm.org/D10325
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Apr 2021 00:12:07 +0200] rev 46850
test: explicitly use zlib compression in tests/test-share-safe.t
We need the implicit value to be explicit until we can change the default in
some case.
Differential Revision: https://phab.mercurial-scm.org/D10323
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 18:50:32 +0200] rev 46849
test: explicitly use zlib compression in tests/test-upgrade-repo.t
We need the implicit value to be explicit until we can change the default in
some case.
Differential Revision: https://phab.mercurial-scm.org/D10322
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 06 Apr 2021 18:49:01 +0200] rev 46848
test: explicitly use zlib compression in tests/test-repo-compengines.t
We need the implicit value to be explicit until we can change the default in
some case.
Differential Revision: https://phab.mercurial-scm.org/D10321
Kyle Lippincott <spectral@google.com> [Tue, 06 Apr 2021 14:21:03 -0700] rev 46847
remotefilelog: include file contents in bundles produced during strip
`hg strip` and other things that use repair.strip (such as the narrow
extension's `hg tracked --removeinclude`) will "save" some commits that have a
higher revision number than the oldest commit we're stripping, but aren't
actually descended from any of the commits that we're stripping. It saves them
in a bundle, and then reapplies them to the repo.
Remotefilelog doesn't generally participate in strip, it doesn't contribute
files to either the backup bundle or the "saved" bundle, and doesn't adjust
linknodes when commits are stripped. This can break things like push, which
rely on the linknodes.
This change makes it so that remotefilelog includes files in these bundles
during strip operations. During reapplication, the files are reapplied from the
bundle, and the linknode is properly updated.
Differential Revision: https://phab.mercurial-scm.org/D10320
Kyle Lippincott <spectral@google.com> [Tue, 06 Apr 2021 15:38:33 -0700] rev 46846
tests: add test-remotefilelog-strip.t to demonstrate an issue with linknodes
### Background
Every time a commit is modified, remotefilelog updates the metadata for the file
object to point to the new commit (I believe that this is different from
non-remotefilelog hg, which leaves the linkrevs pointing to the obsolete
commits; doing otherwise would involve changing data in the middle of revlogs).
With `hg strip` (or other things that use repair.strip()), when you strip a
commit that's not the tip of the revlog, there may be commits after it in revnum
order that aren't descended from it and don't need to be (and shouldn't be)
stripped. These are "saved" by strip in a bundle, and that bundle is reapplied
after truncating the relevant revlogs.
### The problem
Remotefilelog generally avoids being involved at all in strip. Currently, that
includes even providing file contents to this backup bundle. This can cause the
linknode to point to a changeset that is no longer in the repository.
Example:
```
@ 3
df91f74b871e
|
| x 2
70494d7ec5ef
|/
| x 1
1e423846dde0
|/
o 0
b292c1e3311f
```
Commits 1, 2, and 3 are related via obsolescence, and are description-only
changes. The linknode for the file in these commits changed each time we updated
the description, so it's currently df91f7. If I strip commits 1 and 3, however,
the linknode *remains* df91f7, which no longer exists in the repository. Commit
70494d was "saved", stripped, and then reapplied, so it is in the repository (as
revision 1 instead of 2 now), and was unobsoleted since the obsmarker was
stripped as well. The linknode for the file should point to 70494d, the most
recent commit that is in the repository that modified the file.
Remotefilelog has some logic to handle broken linknodes, but it can be slow. We
have actually disabled it internally because it's too slow for our purposes.
Differential Revision: https://phab.mercurial-scm.org/D10319