Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 23:20:32 +0200] rev 47472
censor: migrate the logic to a set of `censor_revs`
Instead of considering a special unique censored revision within the code, we
consider a set of revision (currently always of size 1). This make the main code
less censor-centric and prepare for the usage of a similar approach for
stripping changesets.
Differential Revision: https://phab.mercurial-scm.org/D10903
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 22:35:37 +0200] rev 47471
censor: rename `rl` to `revlog` in the main function
Now that the bulk of the code moved to smaller function we are less restricted
on line length and we can use more explicite naming.
Differential Revision: https://phab.mercurial-scm.org/D10902
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 22:28:51 +0200] rev 47470
censor: extract the part about creating and opening new files in a function
The v2_censor function is huge, now that its content has settled a bit it is a
good time to split individual part inside dedicated function.
The last part is the file copying and opening logic. It now have its own
function.
Differential Revision: https://phab.mercurial-scm.org/D10901
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 22:10:22 +0200] rev 47469
censor: extract the part about recomputing delta in a function
The v2_censor function is huge, now that its content has settled a bit it is a
good time to split individual part inside dedicated function.
It is now the turn of the logic that recompute new delta to replace the one
based on the revision that are going away.
Differential Revision: https://phab.mercurial-scm.org/D10900
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 21:49:31 +0200] rev 47468
censor: extract the part about writing the other revision in a function
The v2_censor function is huge, now that its content has settled a bit it is a
good time to split individual part inside dedicated function.
We continue with a small function that add a non-censored revision back to the
revlog.
Differential Revision: https://phab.mercurial-scm.org/D10899
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 21:41:33 +0200] rev 47467
censor: extract the part about writing the censored revision in a function
The v2_censor function is huge, now that its content has settled a bit it is a
good time to split individual part inside dedicated function. We start with a
small function that process the censored revision.
Differential Revision: https://phab.mercurial-scm.org/D10898
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 21:22:55 +0200] rev 47466
censor: put the tuple of open files in an explicit variable
This will be simpler to pass these file around in future changesets.
Differential Revision: https://phab.mercurial-scm.org/D10897
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 22 Jun 2021 11:09:25 +0200] rev 47465
revlog: rewrite `censors.py` to `rewrite.py`
The logic we use for censoring revision will be mostly common with the one we
needs for stripping. So we rename the module to `rewrite` to better match its
future content.
Differential Revision: https://phab.mercurial-scm.org/D10896
Mathias De Mare <mathias.de_mare@nokia.com> [Wed, 30 Jun 2021 14:17:28 +0200] rev 47464
Backed out changeset
9b8f326731ac
Unfortunately, disabling the rust extensions means newer
Mercurial versions no longer have the persistent-nodemap
feature enabled.
This means a Mercurial 5.8.1 on RPM-based Linux distributions
will no longer be able to read repositories created
by a Mercurial 5.8 on RPM-based Linux distributions.
This violates the compatibility rules
(see https://www.mercurial-scm.org/wiki/CompatibilityRules ).
For this reason, I have to backout this change.
I'll try to find another solution to the 'hg purge' crashes.
Differential Revision: https://phab.mercurial-scm.org/D10918
Simon Sapin <simon.sapin@octobus.net> [Thu, 17 Jun 2021 19:48:25 +0200] rev 47463
copies: Keep changelog sidedata file open during copy tracing
Instead of having a callback that opens and closes that file many times,
a add and use a context manager method on the `revlog` class that keeps
files open for its duration.
Differential Revision: https://phab.mercurial-scm.org/D10888
Matt Harbison <matt_harbison@yahoo.com> [Tue, 22 Jun 2021 13:18:29 -0400] rev 47462
purge: restore the `testedwith` declaration
Otherwise, this extension gets highlighted as a 3rd party extension when an
exception occurs.
Differential Revision: https://phab.mercurial-scm.org/D10895
Raphaël Gomès <rgomes@octobus.net> [Mon, 21 Jun 2021 17:29:22 +0200] rev 47461
rust: remove dead utils module
This was introduced a while back while not being imported anywhere in the
module system. How pertinent this Facebook module was to the codebase was
debatable at the time, nowadays with the Rust VFS layer having laid its
foundations, it is clear that we should drop it.
Differential Revision: https://phab.mercurial-scm.org/D10890
Martin von Zweigbergk <martinvonz@google.com> [Mon, 21 Jun 2021 10:01:55 -0700] rev 47460
rebase: use str-keyed opts in remaining places
Differential Revision: https://phab.mercurial-scm.org/D10892
Martin von Zweigbergk <martinvonz@google.com> [Mon, 21 Jun 2021 09:54:36 -0700] rev 47459
rebase: keep str-keyed opts long enough to make `action` a str
This is just another little py3 cleanup.
Differential Revision: https://phab.mercurial-scm.org/D10891
Martin von Zweigbergk <martinvonz@google.com> [Tue, 22 Jun 2021 08:24:27 -0700] rev 47458
benchmarks: restore `output` variable lost in D10884
Noticed by pyflakes (which I didn't have installed for Python 3.9 when
I sent D10884).
Differential Revision: https://phab.mercurial-scm.org/D10894
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Jun 2021 11:59:27 +0200] rev 47457
censor: implement censoring for revlogv2
It is a bit verbose and rough, but it works. Most of that logic can be common
for `stripping`, so we can expect more refactoring of that code to accommodate
both needs. However I wanted to keep this changesets "simple enough" and before
moving forward.
We also need to properly delete the older index/data/sidedata file, but this has
implication for streaming clone and transaction, so this will come later.
Differential Revision: https://phab.mercurial-scm.org/D10869
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 20 Jun 2021 23:05:58 +0200] rev 47456
deltas: at a `target_rev` parameter to finddeltainfo
Otherwise, recomputing a delta for a revision might result in a delta against a
later revision or a full snapshot thinking we are appending a new revision.
We will make use of this during censoring (and later, stripping).
Differential Revision: https://phab.mercurial-scm.org/D10887
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 19:47:29 +0200] rev 47455
revlog: list older-but-still-around file in `files`
These older files will eventually be removed, but we have to take them in account until they are. So we update `files` to keep fncache happy.
Differential Revision: https://phab.mercurial-scm.org/D10868
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 29 May 2021 00:11:12 +0200] rev 47454
revlog: add docket method to request new content files
If we want to write content into new files, we need to be able to ask for them.
Differential Revision: https://phab.mercurial-scm.org/D10867
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 20 May 2021 21:47:09 +0200] rev 47453
revlog: add a way to keep track of older uids in the docket
When the revlog content is rewritten, we will use new files, to avoid truncating
the previous ones. We need some way to keep track of the older files before we
clean them up.
Differential Revision: https://phab.mercurial-scm.org/D10866
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 21 Jun 2021 15:00:53 +0200] rev 47452
revlog: factor the logic to determine the delta compression out
This make the logic clearly isolated and documented and it will help use to
reuse it during censors/strip.
Differential Revision: https://phab.mercurial-scm.org/D10889
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 10 Jun 2021 00:16:54 +0200] rev 47451
nodemap: fix some comment formatting
Black seems unhappy about it.
Differential Revision: https://phab.mercurial-scm.org/D10865
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 12:19:42 +0200] rev 47450
revlogv2: fix `hg verify` with revlog v2
We added a bunch of new files but we never teached some internal about it. This
is now fixed.
Differential Revision: https://phab.mercurial-scm.org/D10858
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 02:34:59 +0200] rev 47449
revlogv2: also test that local clone works
This is now the case so lets add a test.
Differential Revision: https://phab.mercurial-scm.org/D10857
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 03:56:33 +0200] rev 47448
clone: also report the bookmark file as copied
This is a small UI adjustement, but this is easy enough to do.
Differential Revision: https://phab.mercurial-scm.org/D10856
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 02:06:45 +0200] rev 47447
clone: reuse the stream clone logic for local clone
Streaming clone and local (non `--pull`) clone do mostly the same thing,
however they were using different logic to do so. This means the logic
frequently went out of sync and that new case had to be dealt with twice.
This is fragile and anoying. So we replace this with a re-use of the logic we
use for streaming clone.
I can see various test changes:
- a more precise progress output,
- armless fncache loading during clone,
- fncache is no longer hardlinked (since we write it by hand).
I am not reinstalling the `reposimplestore` specific output, as far as I
understand this variant have been broken for years.
Differential Revision: https://phab.mercurial-scm.org/D10855
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 15:33:58 +0200] rev 47446
copyfiles: add a way to relax the file system checking for hardlink
This is critical for transaction file, less for hardlink/copy clone as we are
about to do. Since `pure` build does not have a `getfstype` implementation this
would disable hardlink clone for all pure build. So we add a parameter to
control that extra check.
Differential Revision: https://phab.mercurial-scm.org/D10854
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 02:31:17 +0200] rev 47445
copyfile: add a option callback for failed hardlinking
Local clone, adjust its UI depending on the success of using hardlinking, so we
add a small callback making it possible for `copyfile` to signal if the
requested hardlinking failed.
Differential Revision: https://phab.mercurial-scm.org/D10853
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 02:06:02 +0200] rev 47444
streamingclone: extract the scanning part from the generation part
We will reuse the scanning part for local clone, so we need it in a dedicated
function.
Differential Revision: https://phab.mercurial-scm.org/D10852
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 02:05:05 +0200] rev 47443
vfs: add a `register_file` method on the vfs class
This is used by the fncache vfs to register new file. Until now, `fncache` have
been doing this "automatically" by monitoring write pattern. However this is
fragile and when we copy files in place by other means, we need something more
robuts. So we add an explicit method to do so.
Differential Revision: https://phab.mercurial-scm.org/D10851
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 01:10:34 +0200] rev 47442
clone: use "official" API to create local clone destination
This make sure we have a properly created, fully functional repository early.
This will be useful to simply the hardlink/copy phases of the local clone to
make it share more of its logic with the similar "stream" cloning.
This has a minor impact of the test and the resulting repository has is better initialized (eg: the `wcache` directory is pre-created.)
Differential Revision: https://phab.mercurial-scm.org/D10850
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 01:10:26 +0200] rev 47441
localrepo: introduce a clone_requirements function
This function take a source repository and return a relevant set of
requirements that should be used by a copy clone.
This will help make the creation of the destination repository during copy
clone simpler.
Differential Revision: https://phab.mercurial-scm.org/D10849
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Jun 2021 20:40:43 +0200] rev 47440
createrepository: allow to directly pass the target requirements
This is useful when doing a local clone that copies store contents, it will
requires the destination to use the very same store requirements so directly
providing them will be simpler and safer
Differential Revision: https://phab.mercurial-scm.org/D10848
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 16:03:42 -0700] rev 47439
narrowbundle: use new context manager for silencing the ui
Same reasoning as the previous change. This affects a few tests
because of the hack from
d7304434390f (changegroup: move message about
added changes to transaction summary, 2019-09-08).
Differential Revision: https://phab.mercurial-scm.org/D10886
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 16:00:58 -0700] rev 47438
debugbackupbundle: use new context manager for silencing the ui
A difference between setting `ui.quiet` and using `ui.silent()` is
that the latter also silences `ui.write()` calls. That's practically
always what one wants, including here, I think.
Differential Revision: https://phab.mercurial-scm.org/D10885
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 15:48:51 -0700] rev 47437
ui: add a context manager for silencing the ui (pushbuffer+popbuffer)
We often silence the ui by calling `ui.pushbuffer()` followed (a later
in the code) by `ui.popbuffer()`. These places can be identified by
the fact that they ignore the output returned from
`ui.popbuffer()`. Let's create a context manager for these cases, to
avoid repetition, and to avoid accidentally leaving the ui silent on
exceptions. I deliberately called the new function `silent()` instead
of `buffered()`, because it's just an implementation detail that it
uses `pushbuffer()` and `popbuffer()`. We could later optimize it to
not buffer the output.
Differential Revision: https://phab.mercurial-scm.org/D10884
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 14:17:43 -0700] rev 47436
shelve: don't swallow errors that happen when reverting the working copy
Same reasoning as the parent commit. The code in question here comes
from
fb8065de47b0 (unshelve: silence internal revert, 2014-08-15),
which says that it was to prepare for some upcoming revert changes. I
suppose those changes have happened by now but we fixed something
about it, because I don't see any unwanted changes in tests (no
changes at all in tests, in fact).
Differential Revision: https://phab.mercurial-scm.org/D10883
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 13:55:45 -0700] rev 47435
histedit: don't swallow errors that happen when updating the working copy
Commit
34165875fa5d (histedit: limit updated and merging output to
important updates, 2016-02-03) added a call to
`ui.pushbuffer(labeled=True, errors=True)`. I don't know if there was
a reason for the `errors=True` (nor the `labeled=True` bit, which I
removed in the previous commit). It seems bad to just discard the
errors, so let's not do that. By not doing that, we can also remove a
workaround for the lack of errors from `test-removeemptydirs.t`.
Differential Revision: https://phab.mercurial-scm.org/D10882
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 13:44:05 -0700] rev 47434
histedit: don't record labels for output that we will discard
Differential Revision: https://phab.mercurial-scm.org/D10881
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 15:56:55 -0700] rev 47433
dog-raft: work with str-keyed opts throughout
Differential Revision: https://phab.mercurial-scm.org/D10864
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 15:45:22 -0700] rev 47432
cmdutil: make resolvecommitoptions() work on str-keyed opts
As with `checknotesize()`, I also changed to snake_case while at it,
to help extensions a little.
Differential Revision: https://phab.mercurial-scm.org/D10863
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:55:10 -0700] rev 47431
cmdutil: make amend() take str-keyed opts
I couldn't think of a reasonable change to the signature here, so
unfortunately it keeps the existing one.
Differential Revision: https://phab.mercurial-scm.org/D10862
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:47:14 -0700] rev 47430
commit: keep opts dict str-keyed a bit longer
Differential Revision: https://phab.mercurial-scm.org/D10861
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:36:26 -0700] rev 47429
dog-raft: keep opts dict str-keyed a bit longer
Differential Revision: https://phab.mercurial-scm.org/D10860
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:25:16 -0700] rev 47428
cmdutil: make checknotesize() work on str-keyed opts
Since this patch changes the behavior of the function, I consider it a
bonus if the signature also changes so that extensions can detect
which version they're dealing with (for the record, I don't have any
such extensions). Therefore, I also dropped an unused `ui` argument
and renamed the function to use snake_case.
Differential Revision: https://phab.mercurial-scm.org/D10859
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 10:53:43 -0700] rev 47427
amend: work mostly with str-type **opts for simplicity
Differential Revision: https://phab.mercurial-scm.org/D10880
Simon Sapin <simon.sapin@octobus.net> [Tue, 15 Jun 2021 12:34:14 +0200] rev 47426
revlog: use file read caching for sidedata
The previous changeset extracted this caching logic from the revlog class into
a new class. Adding a new instance of that class allows using the same logic
for side data.
Differential Revision: https://phab.mercurial-scm.org/D10879
Simon Sapin <simon.sapin@octobus.net> [Tue, 08 Jun 2021 19:55:00 +0200] rev 47425
revlog: Extract low-level random-access file read caching logic
The `revlog` class does many things, among which fulfilling requests for
arbitrary byte slices from the revlog "data file" by reading a larger chunk
and caching it in memory, in order to reduce the number of system calls.
This extracts that logic into a new class, so that it may later also be used
for the side-data file (with another instance of that class).
The copyright notice of the new file does not include a date or author name
since such information tend not to be kept up-to-date:
https://www.linuxfoundation.org/en/blog/copyright-notices-in-open-source-software-projects/
Differential Revision: https://phab.mercurial-scm.org/D10878