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