Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 09:03:24 +0200] rev 47358
verify: use some intermediate variables instead of a multi-liner
This is shorter and easier to read as the indentation remains the same.
We extract the long message in a module level constant for clarity.
Differential Revision: https://phab.mercurial-scm.org/D10810
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 09:01:23 +0200] rev 47357
verify: use some intermediate variables instead of a multi-liner
This is shorter and easier to read as the indentation remains the same.
Differential Revision: https://phab.mercurial-scm.org/D10809
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 08:59:50 +0200] rev 47356
verify: use some intermediate variables instead of a multi-liner
This is shorter and easier to read as the indentation remains the same.
Differential Revision: https://phab.mercurial-scm.org/D10808
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 08:59:07 +0200] rev 47355
verify: use some intermediate variables instead of a multi-liner
This is shorter and easier to read as the indentation remains the same.
Differential Revision: https://phab.mercurial-scm.org/D10807
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 08:58:53 +0200] rev 47354
verify: expand a one liner into explicit commands
The result is not longer, but it is more edible.
Differential Revision: https://phab.mercurial-scm.org/D10806
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 01 Jun 2021 08:54:53 +0200] rev 47353
verify: align a comment line
This argument description is back with it comrade.
Differential Revision: https://phab.mercurial-scm.org/D10805
Simon Sapin <simon.sapin@octobus.net> [Tue, 01 Jun 2021 16:55:59 +0200] rev 47352
dirstate-v2: Drop parent directory cache when removing a dirstate node
The premise of the directory cache is that the dirstate contains child nodes
for every entry that `read_dir` would return. When removing nodes, that may
not be the case anymore so the cache should be invalidated.
Differential Revision: https://phab.mercurial-scm.org/D10829
Simon Sapin <simon.sapin@octobus.net> [Mon, 31 May 2021 19:54:41 +0200] rev 47351
dirstate-v2: Add --dirs to debugdirstate command
`hg debugdirstate --dirs` also shows information stored in the dirstate
(for `read_dir` caching) about directories.
Differential Revision: https://phab.mercurial-scm.org/D10828
Simon Sapin <simon.sapin@octobus.net> [Mon, 31 May 2021 18:35:44 +0200] rev 47350
dirstate-v2: Write .hg/dirstate back to disk on directory cache changes
Differential Revision: https://phab.mercurial-scm.org/D10827
Simon Sapin <simon.sapin@octobus.net> [Fri, 28 May 2021 11:48:59 +0200] rev 47349
dirstate-v2: Skip readdir in status based on directory mtime
When calling `read_dir` during `status` and the directory is found to be
eligible for caching (see code comments), write the directory’s mtime to the
dirstate. The presence of a directory mtime in the dirstate is meaningful
and indicates eligibility.
When an eligible directory mtime is found in the dirstate and `stat()` shows
that the mtime has not changed, `status` can skip calling `read_dir` again
and instead rely on the names of child nodes in the dirstate tree.
The `tempfile` crate is used to create a temporary file in order to use its
modification time as "current time" with the same truncation as other files
and directories would have in their own modification time.
Differential Revision: https://phab.mercurial-scm.org/D10826
Simon Sapin <simon.sapin@octobus.net> [Thu, 27 May 2021 18:40:54 +0200] rev 47348
dirstate-v2: Allow tree nodes without an entry to store a timestamp
Timestamps are stored on 96 bits:
* 64 bits for the signed number of seconds since the Unix epoch
* 32 bits for the nanoseconds in the `0 <= ns < 1_000_000_000` range
For now timestamps are not used or set yet.
Differential Revision: https://phab.mercurial-scm.org/D10825
Simon Sapin <simon.sapin@octobus.net> [Fri, 28 May 2021 20:07:27 +0200] rev 47347
dirstate-tree: Change status() results to not borrow DirstateMap
The `status` function takes a `&'tree mut DirstateMap<'on_disk>` parameter.
`'on_disk` borrows a read-only byte buffer with the contents of the
`.hg/dirstate` file. `DirstateMap` internally uses represents file paths as
`std::borrow::Cow<'on_disk, HgPath>`, which borrows the byte buffer when
possible and allocates an owned string if not, such as for files added to the
dirstate after it was loaded from disk.
Previously the return type of of `status` has a `'tree` lifetime, meaning it
could borrow all paths from the `DirstateMap`. With this changeset, that
lifetime is changed to `'on_disk` meaning that only paths from the byte buffer
can be borrowed, and paths allocated by `DirstateMap` must be copied.
Usually most paths are in the byte buffer, and most paths are not part of the
return value of `status`, so the number of extra copies should be small.
This change will enable `status` to mutate the `DirstateMap` after it has
finished constructing its return value. Previously such mutation would be
prevented by possible on-going borrows.
Differential Revision: https://phab.mercurial-scm.org/D10824
Simon Sapin <simon.sapin@octobus.net> [Fri, 28 May 2021 12:16:14 +0200] rev 47346
dirstate-tree: Fix status algorithm with unreadable directory
When reading a directory fails such as because of insufficient permissions,
it should be treated as empty by status instead of skipped entirely.
Differential Revision: https://phab.mercurial-scm.org/D10823
Martin von Zweigbergk <martinvonz@google.com> [Tue, 25 May 2021 16:46:32 -0700] rev 47345
docket: make compatible with py3.6, where Struct.format is bytes
Differential Revision: https://phab.mercurial-scm.org/D10770
Mathias De Mare <mathias.de_mare@nokia.com> [Tue, 15 Jun 2021 09:06:12 +0200] rev 47344
packaging: disable rust extensions again on CentOS
Backed out changeset
eccbfa7e19c0
We're seeing (very rarely) crashes of 'hg purge' on some of our machines
(see https://bz.mercurial-scm.org/show_bug.cgi?id=6509 ).
Unfortunately, I haven't been able to find out much more about
what is going wrong.
To avoid further impact on our users and CI,
I would prefer to disable the rust extensions for now.
Differential Revision: https://phab.mercurial-scm.org/D10877
Georges Racinet <georges.racinet@octobus.net> [Sun, 06 Jun 2021 01:24:30 +0200] rev 47343
cext: fix memory leak in phases computation
Without this a buffer whose size in bytes is the number of
changesets in the repository is leaked each time the repository is
opened and changeset phases are computed.
Impact: the current code in hgwebdir creates a new `localrepository`
instance for each HTTP request. Since any pull or push is made of several
requests, a team of 100 people can easily produce thousands of such
requests per day.
Being a low-level malloc, this leak can't be seen with the gc module and
tools relying on that, but was spotted by valgrind immediately.
Reproduction
------------
for i in range(cl_args.iterations):
repo = hg.repository(baseui, repo_path)
rev = repo.revs(rev).first()
ctx = repo[rev]
del ctx
del repo
# avoid any pollution by other type of leak
# (that should be fixed in 5.8)
repoview._filteredrepotypes.clear()
gc.collect()
Measurements
------------
Resident Set Size (RSS), taken on a clone of
mozilla-central for performance analysis (440 000
changesets).
before:
5.8+hg19.
5ac0f2a8ba72 1000 iterations: 1606MB
5.8+hg19.
5ac0f2a8ba72 10000 iterations: 5723MB
after:
5.8+hg20.
e2084d39e145 1000 iterations: 555MB
5.8+hg20.
e2084d39e145 10000 iterations: 555MB
(double checked, not a copy/paste error)
(
e2084d39e14 is the present changeset, before amendment
of the message to add the measurements)
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 30 May 2021 22:12:48 +0200] rev 47342
revlogv2: make sure bundling pick a compatible bundle format
Before this change, revlog-v2 repository where bundled using the incompatible
"v1" format.
Differential Revision: https://phab.mercurial-scm.org/D10802
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 30 May 2021 20:42:51 +0200] rev 47341
censor: do not process sidedata of censored revision while bundling
The revision is censored, we should ignore it.
Differential Revision: https://phab.mercurial-scm.org/D10801
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 May 2021 20:00:27 +0200] rev 47340
changegroup: fix deltachunk API to be consistent from one class to another
Depending of the subclass the 8th index of `chunkdata` items was either a
sidedata dict of a proto_flags integer. We have not fixed the inconsistency and
we already return fixed "delta" items from `deltaiter`.
Differential Revision: https://phab.mercurial-scm.org/D10778
Augie Fackler <augie@google.com> [Thu, 27 May 2021 12:10:59 -0400] rev 47339
fuzz: add hg to sys.path when constructing mpatch corpus
Differential Revision: https://phab.mercurial-scm.org/D10777
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 16:18:16 +0200] rev 47338
dirstate-tree: Skip readdir() in `hg status -mard`
When running the status algorithm in a mode where we don’t list unknown
or ignored files, all we care about are files that are listed in the dirstate.
We can there for skip making expensive calls to readdir() to list the contents
of filesystem directories, and instead only run stat() to get the filesystem
state of files listed in the dirstate. (This state may be an error for files
that don’t exist anymore on the filesystem.)
On 16 CPU threads, this reduces the time spent in the `status()` function for
`hg status -mard` on an old snapshot of mozilla-central from ~70ms to ~50ms.
Differential Revision: https://phab.mercurial-scm.org/D10752
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47337
dirstate-v2: Parse the dirstate lazily, with copy-on-write nodes
TODO: more description
Differential Revision: https://phab.mercurial-scm.org/D10751
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47336
dirstate-v2: Make the dirstate bytes buffer available in more places
Differential Revision: https://phab.mercurial-scm.org/D10750
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47335
dirstate-v2: Make more APIs fallible, returning Result
When parsing becomes lazy, parse error will potentially happen in more places.
This propagates such errors to callers.
Differential Revision: https://phab.mercurial-scm.org/D10749
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47334
dirstate-v2: Add a zero-size error type for dirstate v2 parse errors
This error should only happen if Mercurial is buggy or the file is corrupted.
It indicates for example that:
* A part of the file refers to another part, and the byte offset or item count
would cause reading out of bounds, beyond the end of the file.
* The byte for an entry state has an invalid value
When parsing becomes lazy, many more functions will return a `Result` with
this error. Making it zero-size reduces the work that the `?` operator needs
to do to pass around the error value.
Differential Revision: https://phab.mercurial-scm.org/D10748
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47333
dirstate-tree: Add `NodeRef` and `ChildNodesRef` enums
They are used instead of `&Node` and `&ChildNodes` respectively.
The `ChildNodes` type alias also becomes a similar enum.
For now they only have one variant each, to be extended later.
Adding enums now forces various use sites go through new methods
instead of manipulating the underlying data structure directly.
Differential Revision: https://phab.mercurial-scm.org/D10747
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47332
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
This will enable the tree-based DirstateMap to not always have an actual
DirstateEntry in memory for all nodes, but construct it on demand.
Differential Revision: https://phab.mercurial-scm.org/D10746
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47331
dirstate-tree: Downgrade `&mut Node` to `&Node` in status and serialization
Mutable access is not used, and upcoming changes will make it more costly
(with copy-on-write nodes that can be read from disk representation)
Differential Revision: https://phab.mercurial-scm.org/D10745
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47330
dirstate-tree: Remove DirstateMap::iter_node_data_mut
In an upcoming changeset we want DirstateMap to be able to work directly
with nodes in their "on disk" representation, without always allocating
corresponding in-memory data structures. Nodes would have two possible
representations: one immutable "on disk" refering to the bytes buffer
of the contents of the .hg/dirstate file, and one mutable with HashMap
like the curren data structure.
These nodes would have copy-on-write semantics: when an immutable node
would need to be mutated, instead we allocate new mutable node for it and
its ancestors.
A mutable iterator of the entire tree would still be possible, but it would
become much more expensive since we’d need to allocate mutable nodes for
everything.
Instead, remove this iterator. It was only used to clear ambiguous mtimes
while serializing the `DirstateMap`. Instead clearing and serialization are
now two separate passes. Clearing first uses an immutable iterator to collect
the paths of nodes that need to be cleared, then accesses only those nodes
mutably.
Differential Revision: https://phab.mercurial-scm.org/D10744
Matt Harbison <matt_harbison@yahoo.com> [Fri, 28 May 2021 17:33:20 -0400] rev 47329
merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 26 May 2021 21:46:45 +0200] rev 47328
revlog: close the index file handle after the data one
This make sure the data file is flushed before the index. preventing the index
to reference unflushed data.
Differential Revision: https://phab.mercurial-scm.org/D10776
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 26 May 2021 21:35:51 +0200] rev 47327
revlog: simplify the try nesting in the `_writing` context
Lets use a single try, with conditional cleanup. This make is easier to add a
file handle dedicated to sidedata.
Differential Revision: https://phab.mercurial-scm.org/D10775
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 20 May 2021 21:54:21 +0200] rev 47326
revlogv2: add a `get_data` helper to grab the next piece of docket
This make the processing more compact but abstracting repetitive processing
away.
Differential Revision: https://phab.mercurial-scm.org/D10774
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 20 May 2021 21:48:53 +0200] rev 47325
revlogv2: simplify and clarify the processing of each entry
As we add more entries and some of them has non trivial processing it seems
useful to make the processing leaner and clearly separated to simplify futures
patches.
Differential Revision: https://phab.mercurial-scm.org/D10773
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 19 May 2021 16:55:36 +0200] rev 47324
revlogv2: use a unique filename for data
Having a unique data will allow for ambiguity less rewriting of revlog content,
something useful to clarify handling of some operation like censoring or
stripping.
Differential Revision: https://phab.mercurial-scm.org/D10772
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 May 2021 15:07:17 +0200] rev 47323
revlogv2: use a unique filename for index
Having a unique index will allow for ambiguity less rewriting of revlog content,
something useful to clarify handling of some operation like censoring or
stripping.
Differential Revision: https://phab.mercurial-scm.org/D10771
Simon Sapin <simon.sapin@octobus.net> [Sat, 22 May 2021 17:35:54 +0200] rev 47322
rhg: A missing .hg/dirstate file is not an error
Instead treat it as like an empty file
Differential Revision: https://phab.mercurial-scm.org/D10766
Simon Sapin <simon.sapin@octobus.net> [Sat, 22 May 2021 17:32:09 +0200] rev 47321
rhg: Sort `rhg status` output correctly
* The relative order of states is:
modified, added, removed, deleted, unknown, ignored, clean
* Files in the same state should be sorted by name, regardless of whether
or not the were in "unsure" state based on metadata alone.
Differential Revision: https://phab.mercurial-scm.org/D10765
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 18:35:43 +0200] rev 47320
dirstate-v2: Add `hg debugupgraderepo` command support
This command changes changes the file formats used inside an existing
repository to what they would be in a new repository with the current config.
For example:
hg debugupgraderepo --config format.exp-dirstate-v2=1 --run
hg debugupgraderepo --config format.exp-dirstate-v2=0 --run
If a repository has a dirstate in v1 format, the first command would upgrade it
to dirstate-v2. Conversely, if a repository has a dirstate in v2 format, the
second command would downgrade it to v1. (Both may also run some unrelated
upgrades.)
Since `format.exp-dirstate-v2` is currently disabled by default, not specifying
it in `--config` or any configuration file would result in the second command.
Differential Revision: https://phab.mercurial-scm.org/D10769
Simon Sapin <simon.sapin@octobus.net> [Fri, 21 May 2021 17:12:47 +0200] rev 47319
upgrade: Use `improvement` subclasses everywhere, not instances
This changes the source definition of optimizations to match that of formats:
a subclass with a decorator, instead of an instance passed to a function call.
Not having any instance removes the confusion between class attributes and
instance attributes, which were used interchangeably.
Differential Revision: https://phab.mercurial-scm.org/D10768
Matt Harbison <matt_harbison@yahoo.com> [Thu, 20 May 2021 14:20:39 -0400] rev 47318
tests: monkeypatch `util.get_password()` to avoid deadlocks on Windows
This should have been part of
5b3513177f2b.
Differential Revision: https://phab.mercurial-scm.org/D10759
Raphaël Gomès <rgomes@octobus.net> [Tue, 04 May 2021 10:46:50 +0200] rev 47317
rust-status: fix ignore and include not composing (
issue6514)
While the fix is pretty simple, the overall dispatch logic has become kind of
ugly. Thankfully we're currently upstreaming a better algorithm, this code is
temporary anyway.
Differential Revision: https://phab.mercurial-scm.org/D10639
Raphaël Gomès <rgomes@octobus.net> [Tue, 04 May 2021 10:33:36 +0200] rev 47316
rust-status: highlight a bug in Rust-augmented status
This was reported in
issue6514, confirmed with this test reproduction.
This will be fixed with the next changeset.
Differential Revision: https://phab.mercurial-scm.org/D10638
Matt Harbison <matt_harbison@yahoo.com> [Tue, 11 May 2021 01:05:38 -0400] rev 47315
exewrapper: avoid directly linking against python3X.dll
Subsequent code calls `LoadLibrary()` to attempt to load the DLL, but because of
this symbol reference, there is an attempt to load the DLL used during the build
prior to `_main()` running. This causes the whole process to fail if the DLL
isn't in the standard search path. That also means it will never load the DLL
for HackableMercurial. (Maybe we should get rid of that for py3, since you can
install python for a user without admin rights?)
This could also be resolved by calling `GetProcAddress()` on the symbol and
dereferencing it, but using the environment variable is consistent with the
*.bat file since
fc8a5c9ecee0. (The environment variable persists after the
interpreter is initialized.)
Far more concerning is somehow I've gotten my system into a state where setting
the flag causes any output to the pager to be lost (as if it wasn't set at all)
in MSYS, cmd.exe, WSL, and PowerShell using py3.9.0, but the environment
variable works properly. I'm sure this flag worked on some versions of py3, so
I'm not sure what's going on here. This is might be related to init config
related changes in 3.8[1], since it works with 3.7.8, but fails with 3.8.1.
Somebody who understands encoding issues better than I do should give some
thought to if we need to make some changes to our encoding strategy on Windows
with py3.
With or without the flag/envvar, there is proper output if the command is
directly paged by piping to `more.com` (in any environment) or `less` (in MSYS
and WSL), or if paging is disabled with `--pager=no`. Legacy mode is required
though when Mercurial decides to spin up a pager.
[1] https://bugs.python.org/
issue41941
Differential Revision: https://phab.mercurial-scm.org/D10756
Matt Harbison <matt_harbison@yahoo.com> [Thu, 20 May 2021 19:59:03 -0400] rev 47314
tests: partially fix test-transaction-rollback-on-revlog-split.t on Windows
For whatever reason, the extra space causes different output on Windows:
$ printf '% 20d' '1' | xxd -
0000000: 2020 2020 2020 2020 2020 2020 2020 2020
0000010: 2020 2020 31 1
vs WSL:
/mnt/c/Users/Matt/hg/tests$ printf '% 20d' '1' | xxd -
00000000: 2020 2020 2020 2020 2020 2020 2020 2020
00000010: 2020 2031
Without the space, they both agree the last word is 2031. There are other
failures on Windows that I don't understand that are introduced by
46b828b85eb7
and
18415fc918a1.
Differential Revision: https://phab.mercurial-scm.org/D10763
Matt Harbison <matt_harbison@yahoo.com> [Thu, 20 May 2021 19:30:56 -0400] rev 47313
tests: fix test-transaction-safety.t on Windows
Mostly this is about `C:\dir\sub` style paths being turned into `C:dirsub` by
MSYS, and not being about to execute shell scripts in hooks directly. See also
a12819559ccb::
9e3979a25bfe.
Differential Revision: https://phab.mercurial-scm.org/D10762
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 19 May 2021 19:57:55 +0200] rev 47312
docket: move the uid logic in the `revlogutils.docket` module
We want to use it for revlog-v2 (& Co), it seems more logical to have the logic
lives inside the `docket` file than the `nodemap` file.
Differential Revision: https://phab.mercurial-scm.org/D10755
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 19 May 2021 17:12:06 +0200] rev 47311
persistent-nodemap: use the intended uuid size
I overlooked this in the initial implementation. The format already supporting
any uuid size so, nothing horrible should happens.
Differential Revision: https://phab.mercurial-scm.org/D10754
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 19 May 2021 17:19:46 +0200] rev 47310
persistent-nodemap: add a way to make the picked uid predictable
This will make the test less volatile and therefore easier to maintain. I am
setting this is for the persistent nodemap docket first, but my target is to use
similar logic for the revlogv2 (and co) test.
For persisent nodemap, they are too many different in how each test variants (with rust, without rust, etc) needs new uid for this be really useful (right now). However it will be directly useful for the revlogv2 logic.
Differential Revision: https://phab.mercurial-scm.org/D10753
Matt Harbison <matt_harbison@yahoo.com> [Thu, 06 May 2021 19:39:19 -0400] rev 47309
run-tests: disable color in 'auto' mode on Windows if stdout is redirected
Differential Revision: https://phab.mercurial-scm.org/D10761
Matt Harbison <matt_harbison@yahoo.com> [Thu, 06 May 2021 18:52:08 -0400] rev 47308
run-tests: enable color on Windows
In setting up the CI for Windows on heptapod, I noticed it was complaining about
color not being enabled because pygments wasn't installed- even though it was.
I had initially disabled color on Windows when using Windows 7, because that
didn't understand ANSI color codes and made a mess of the output. But now that
it's been unsupported for over a year, I don't think we should care about it
either.
It's admittedly a hack to depend on Mercurial proper to enable color support in
the terminal, but I didn't feel like duplicating that code. I'm under the
impression that 3rd party stuff is supposed to use this runner in the Mercurial
repo instead of using their own copy, so I think it's safe to assume the
Mercurial code is available. If it's not, it won't break anything.
Differential Revision: https://phab.mercurial-scm.org/D10760
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Sun, 16 May 2021 10:57:14 -0400] rev 47307
transaction: trivial refactoring
Differential Revision: https://phab.mercurial-scm.org/D10714
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Tue, 18 May 2021 23:36:21 -0400] rev 47306
test: remove some unnecessary dependency on repo format
Differential Revision: https://phab.mercurial-scm.org/D10757
Raphaël Gomès <rgomes@octobus.net> [Fri, 21 May 2021 17:37:53 +0200] rev 47305
hg-cpython: fix new occuring TypeError
dd339191f2dc introduced a minor refactoring of error types that highlighted
a fragile error creation mechanism that was in place in the Rust `MixedIndex`.
`PyErr::from_instance` also accepts a Python class, as long as it's an
`Exception` class. Before the aforementioned commit, we never ran into a case
where this duck-typing mechanism failed. We rectify this behavior by doing the
instantiation ourselves.
Differential Revision: https://phab.mercurial-scm.org/D10764
Martin von Zweigbergk <martinvonz@google.com> [Thu, 20 May 2021 08:15:57 -0700] rev 47304
errors: make exit codes class variables instead
Kyle pointed out to me that we can simply make the exit codes class
variables. Python provides some magic for making them accessible as
instance variables.
This also makes it easier to let subclasses of existing errors
override the exit codes by letting them simply define their own values
as class variables. That means that there's no need to pass them into
the superclass's constructor arguments, so the superclass doesn't need
to expose the them as arguments. (Making a subclass set a different
exit code for a subclass of `StorageError` was actually the goal with
my recent series.)
Differential Revision: https://phab.mercurial-scm.org/D10758
Charles Chamberlain <cchamberlain@janestreet.com> [Tue, 18 May 2021 13:08:42 -0400] rev 47303
narrow: widen when files are excluded by sparse and not included by narrow
In a repo where some directories are included by narrow and the complement are
excluded by sparse, it was previously impossible to widen either because trying
to widen narrow would complain that the requested files are outside the sparse
checkout and trying to widen sparse would complain that the requested files are
outside the narrow checkout.
This changes the `hg tracked --addinclude` command to only actually update any
newly accessible files in the dirstate if they are also accessible via sparse.
Differential Revision: https://phab.mercurial-scm.org/D10734
Augie Fackler <augie@google.com> [Tue, 18 May 2021 13:34:06 -0400] rev 47302
hghave: make error output easier to diagnose
I had a typo that meant the new bash check was throwing an exception
(due to a missing argument), but it was very hard to diagnose without
this change.
Differential Revision: https://phab.mercurial-scm.org/D10733
Augie Fackler <augie@google.com> [Tue, 18 May 2021 13:24:41 -0400] rev 47301
tests: add req on bash for test-transaction-rollback-on-sigpipe (
issue6429)
I think we could work around this by rewriting the helper scripts in
Python, but I don't want to deal with that now and this should prevent
failures due to a lack of bash.
Differential Revision: https://phab.mercurial-scm.org/D10732
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 17 May 2021 15:24:46 +0200] rev 47300
updatecaches: deprecate the `full` argument
Now that all users were migrated, we can use deprecate the old way. This would
give potential extensions code a heads up on the API change.
Differential Revision: https://phab.mercurial-scm.org/D10731
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 17 May 2021 15:42:18 +0200] rev 47299
updatecaches: use the `caches` argument instead of a special `full` value
After a clone we want to update most cachem, but not exactly all of them. We
can now cleanly express this.
Differential Revision: https://phab.mercurial-scm.org/D10730
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 17 May 2021 15:27:29 +0200] rev 47298
updatecaches: use the caches argument in `hg debugupdatecaches`
This is the new way.
Differential Revision: https://phab.mercurial-scm.org/D10729
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 17 May 2021 14:45:16 +0200] rev 47297
updatecaches: adds a `caches` parameters to `repo.updatecaches`
It will superseed the `full` parameters (and its `post-clone` variant from
stable). Various caller will be updated in the rest of this series.
Differential Revision: https://phab.mercurial-scm.org/D10728
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 17 May 2021 14:41:09 +0200] rev 47296
updatecaches: introduce a set of constants to control which are updated
Passing around a set of constant to select what need warming will be cleaner
and more flexible. We did not changed the API yet, as this changes is already
large enough. In the rest of the rest we will change more code to actually use
this constants (or more realistically pre-defined set of constant directly)
Differential Revision: https://phab.mercurial-scm.org/D10727
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 21:50:09 -0700] rev 47295
errors: make StorageError subclass Error, attaching an exit code to it
Differential Revision: https://phab.mercurial-scm.org/D10741
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 19:33:09 -0700] rev 47294
revlog: avoid raising no-arg RevlogError for internal flow control
I'm about to make RevlogError require a `message` argument and this
code was failing. This patch refactors it to not raise an exception
for intra-function flow control.
Differential Revision: https://phab.mercurial-scm.org/D10740
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 21:45:59 -0700] rev 47293
errors: catch the new Error class in scmutil and chgserver
Differential Revision: https://phab.mercurial-scm.org/D10739
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 21:32:12 -0700] rev 47292
errors: create superclass for Abort exception
I'd like to let extensions subclass `StorageError` to define a custom
exit code. However, `StorageError` does not extend `Abort` (which is
where the exit code currently lives), and it seems that it's not
supposed to either (`StorageError` seems to be for lower-level errors
and `Abort` is for command-level errors). This patch therefore
extracts all the code from `Abort` into a new `Error` class, which
I'll soon make `StorageError` also extend.
Differential Revision: https://phab.mercurial-scm.org/D10738
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 22:07:16 -0700] rev 47291
errors: make InterventionRequired subclass Abort
The docstring for `Abort` says that it's for errors raised by commands
and `InterventionRequired` is definitely something raised by commands,
so it seems that it should be an `Abort`. This patch makes it so. It
adds a `coarse_exit_code` (in addition to the already existing
`detailed_exit_code`) to `Abort` to achieve that, since
`InterventionRequired` should result in a special exit code even when
the `ui.detailed-exit-code` config is not set.
Differential Revision: https://phab.mercurial-scm.org/D10737
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 21:58:12 -0700] rev 47290
errors: move Abort earlier, so more exceptions can subclass it
I'd like to make at least `InterventionRequired` subclass `Abort` and
Python requires the superclass to be defined before the subtype.
Differential Revision: https://phab.mercurial-scm.org/D10736
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 May 2021 17:15:49 -0700] rev 47289
errors: let each Abort subclass define its error code
It's more flexible to have the error codes defined on the error types
themselves. That way extensions can easily set their own exit code. It
also means that we can reduce a bit of duplication betwen
`scmutil.callcatch()` and `chgserver.chgcmdserver.validate()`.
Differential Revision: https://phab.mercurial-scm.org/D10735
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 15:10:49 +0200] rev 47288
rust: Fix "panic message is not a string literal" warnings
These deprecation warnings would not become errors until we actively port
crates to the (not yet released) Rust 2021 edition, but fixing them anyway
reduces console output noise.
Differential Revision: https://phab.mercurial-scm.org/D10743
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 15:08:27 +0200] rev 47287
rust: Add type annotation to fix inference on Rust Nightly
When compiling with Rust Nightly, the im-rs crate silently makes use of the
experimental language feature for trait impl specialization. This apperently
changes public its APIs in subtle ways such that type inference of some user
code can fail where it succeeds when specialization is disabled.
This made Mercurial’s Rust unit tests have compilation errors on Nightly.
I have not managed to find the exactl root cause, but I wrote down my findings
so far at https://github.com/bodil/im-rs/issues/188
This adds type annotation to make unit tests rely less on type inference
and work around the issue.
Differential Revision: https://phab.mercurial-scm.org/D10742
Joerg Sonnenberger <joerg@bec.de> [Wed, 19 May 2021 13:45:34 +0200] rev 47286
recover: only apply last journal record per file (
issue6423)
This got broken in 2019 when the size check was introduced. It is most
noticable when dealing with transactions that involve an inline to
non-inline revlog storage transaction. It wasn't seen as much at the
time because the in-memory journal actually de-duplicated the entry
implicity, but since
63edc384d3b7 the on-disk journal is used for
rollback as well as recover.
Differential Revision: https://phab.mercurial-scm.org/D10726
Joerg Sonnenberger <joerg@bec.de> [Wed, 19 May 2021 13:46:19 +0200] rev 47285
revlog: update data file record before index rename
When migrating from inline to non-inline data storage, the data file is
recorded initially as zero sized so that it is removed on failure. But
the record has to be updated before the index is renamed, otherwise
data is lost on rollback.
Differential Revision: https://phab.mercurial-scm.org/D10725
Joerg Sonnenberger <joerg@bec.de> [Tue, 18 May 2021 02:35:27 +0200] rev 47284
revlog: fix index computation during inline->non-inline transition
The computation in
63edc384d3b7 failed to factor in the index entries
themselve as revlog.start() doesn't count them. Found by Valtenin
Gatienbaron with a more precise test case from me.
Differential Revision: https://phab.mercurial-scm.org/D10724
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47283
dirstate-v2: Change the on-disk format to be tree-shaped
Nodes are stored not only for tracked files but also for their ancestor
directories. A node has "pointers" (byte count from the start of the file)
to its direct child nodes. Everything can be accessed with zero copy.
Differential Revision: https://phab.mercurial-scm.org/D10722
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47282
dirstate-tree: Extract into a method sorting children of a given node
A later changset will use this in another place.
This is an associated function (that Python would call static method)
instead of a free function so it doesn’t need to be imported separately.
It’s on `Node` rather than `ChildNodes` because the latter is a type alias
to an external type (`HashMap`) so that would require an extension trait
which needs to be imported separately.
Differential Revision: https://phab.mercurial-scm.org/D10721
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47281
dirstate-v2: Add a variant of some tests, that uses the new format
With this, the new format receives some testing every time someone runs tests
with Rust extensions enabled, including on CI.
Differential Revision: https://phab.mercurial-scm.org/D10720
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47280
dirstate-v2: Change the on-disk format when the requirement is enabled
For now, the format is the same except with an additional marker at the start.
This marker is redundant: for existing repositories it is `.hg/requires` that
determines which format to use. For new repositories, it is the new
`format.exp-dirstate-v2` config. There is no upgrade or downgrade so far.
Most of the changes are about plumbing a boolean through layers of APIs to
indicate which format should be used.
Differential Revision: https://phab.mercurial-scm.org/D10719
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:15:00 +0200] rev 47279
dirstate-v2: Update the expected output of some tests for new requirement
Fix most test failures (except in test-narrow-debugrebuilddirstate.t and
test-upgrade-repo.t) caused by the new entry in config or in .hg/requires
when running `run-tests.py --extra-config-opt format.exp-dirstate-v2=1`
There is no CI so far for this configuration.
Differential Revision: https://phab.mercurial-scm.org/D10718
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:14:59 +0200] rev 47278
tests: More cleanly separate expected hexdump output
There are more lines that differ than are in common, and dirstate-v2
will complicate that further.
Differential Revision: https://phab.mercurial-scm.org/D10717
Simon Sapin <simon.sapin@octobus.net> [Wed, 19 May 2021 13:14:59 +0200] rev 47277
dirstate-v2: Add a new experimental `exp-dirstate-v2` repository requirement
This requirement is added to `.hg/requires` when creating a new repository
if Rust extensions are enabled and the `format.exp-dirstate-v2` config is set.
Nothing yet changes based on this requirement, but its mere presence affects
some tests (for example if they print `.hg/requires`). The next two changesets
update tests’ expected outputs accordingly.
There is no CI so far that enables this configuration.
Differential Revision: https://phab.mercurial-scm.org/D10716
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 00:16:43 +0200] rev 47276
urlutil: provide some information about "bad url" when processing `pushurl`
It appears pushurl only support `<proto>://` entries. This is not obvious and
can lead to obscure error. We make the error less obscure as a start..
Differential Revision: https://phab.mercurial-scm.org/D10455
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 11 Apr 2021 19:19:34 +0200] rev 47275
revset: document the `outgoing` behavior if the path resolve to multiple urls
Differential Revision: https://phab.mercurial-scm.org/D10454
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 00:19:04 +0200] rev 47274
multi-urls: document the feature
We have a feature lets make it visible to people.
Differential Revision: https://phab.mercurial-scm.org/D10453
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 16 Apr 2021 00:16:47 +0200] rev 47273
multi-urls: add a boolean suboption that unlock path specification as list
When this option is set, a list of patch can be specifed as value for `[paths]`
entries. For the command who support it, this behave the same as providing
multiple destination of the command line.
Differential Revision: https://phab.mercurial-scm.org/D10452
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Apr 2021 20:13:29 +0200] rev 47272
urlutil: move url "fixing" at the time of `ui.paths` initialization
Doing such fixing at the time is simpler and will be necessary to deal with
urls list in a sane manner. It also reduce the size of fix-config which is
always better.
I wish we could get ride of the hackish way to pass the root around, I suspect
that the `root` variable could be stored as part of the config value, along side
the source. However getting to the end of this `root` business is a far too
large detours to make now.
The test change to `tests/test-hgrc.t` and `test-config.t` are expectied since
we are not longer altering the config itself, but the way it is interpreted when
building path. This seems more correct.
I also added a couple of test call to `test-config.t` and `test-globalopts.t` to
clarify that the expanding process is properly happening a the right time.
Differential Revision: https://phab.mercurial-scm.org/D10451
Martin von Zweigbergk <martinvonz@google.com> [Mon, 17 May 2021 15:15:44 -0700] rev 47271
rewriteutil: add pointer to help text when rewrite would cause divergence
The evolve extension's version of the hint has this pointer. I missed
it when I moved it to core.
Differential Revision: https://phab.mercurial-scm.org/D10723
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 11:20:10 +0200] rev 47270
changelogv2: use a dedicated on disk format for changelogv2
We drop two unused entry. This is mostly a proof of concept before starting to
actually rework the format.
Differential Revision: https://phab.mercurial-scm.org/D10667
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 14:18:06 +0200] rev 47269
revlog: do not call Rust code if the index is not compatible with it
This will avoid hitting the TypeError we defined in the previous changesets.
This is the simplest fix but not the most elegant.
Ideally we would teach the Rust code to use any kind of revlog. However this is
an adventure for another time.
Differential Revision: https://phab.mercurial-scm.org/D10666
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 14:16:26 +0200] rev 47268
revlog: signal which revlog index are compatible with Rust
Otherwise, Rust may treat python object like `cindex` object, leading to
trouble. The new attribute is an integer because I expect we might need a flag
field in the future.
As a start we get the rust code to raise a clear TypeError. We will use the
information in a smarter way in the next changesets.
Differential Revision: https://phab.mercurial-scm.org/D10665
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 11:19:48 +0200] rev 47267
revlog: pass around the `rev` we deal with when packing/unpacking entry
This will help code to compute some flag on the fly.
Differential Revision: https://phab.mercurial-scm.org/D10664
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 29 Mar 2021 20:46:56 +0200] rev 47266
changelogv2: use a dedicated version number
If we want to change the format, we need a new version number. We start with
that.
Differential Revision: https://phab.mercurial-scm.org/D10663
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 03:05:52 +0200] rev 47265
changelogv2: `copies-side-data` now implies `changelogv2`
To store information about file changes and copies only requires sidedata
support for the changelog. So we only enables `changelogv2`. This is less
impactful and should help us to ship the changeset centric copy tracing sooner.
Differential Revision: https://phab.mercurial-scm.org/D10662
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 04:32:09 +0200] rev 47264
changelogv2: allow upgrade from and to this format
Differential Revision: https://phab.mercurial-scm.org/D10661
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 29 Mar 2021 22:40:54 +0200] rev 47263
changelogv2: introduce a "changelogv2" feature
Right now, this means using revlogv2, but only for the changelog. We will have
the format more unique in future changesets.
Differential Revision: https://phab.mercurial-scm.org/D10660
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 05:18:57 +0200] rev 47262
revlogv2: drop the code related to inlined revlogv2
Tevlogv2 will not use inlined revlog. As a result we can drop the associated
code.
Differential Revision: https://phab.mercurial-scm.org/D10659
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 02:55:56 +0200] rev 47261
revlogv2: no longer attempt to use inline for new revlog
revlogv2 steered away for the inline feature.
Differential Revision: https://phab.mercurial-scm.org/D10658
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 02:52:24 +0200] rev 47260
sidedata: use the "feature" to detect that sidedata are enabled
This is more versatile than relying on the revlogv2 requirements.
Differential Revision: https://phab.mercurial-scm.org/D10657
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 23:40:05 +0200] rev 47259
revlog: compress sidedata when doing "post-pull" sidedata update
All path writing sidedata are now using compression (when appropriate).
Differential Revision: https://phab.mercurial-scm.org/D10656
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 23:14:48 +0200] rev 47258
revlog: compress sidedata in `_writeentry`
When appropriate we store the sidedata in a compressed form.
Differential Revision: https://phab.mercurial-scm.org/D10655
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 22:48:31 +0200] rev 47257
revlog: apply compression mode while reading sidedata
Right now, we only store things as PLAIN, but we are ready for some compression
now. Future changeset will start using some.
Differential Revision: https://phab.mercurial-scm.org/D10654
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 21:34:02 +0200] rev 47256
revlog: introduce a compression mode for sidedata in the revlog index
We will use this for compression for the sidedata payload.
Differential Revision: https://phab.mercurial-scm.org/D10653
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 21:13:24 +0200] rev 47255
revlog: implement a "default compression" mode
The revlog docker is now storing a default compression engine. When a chunk use
that compression, a dedicated mode is used in the revlog entry and we can
directly route it to the right decompressor.
We should probably make PLAIN and DEFAULT mode the only available mode for
revlogv2, but this is something for later.
Differential Revision: https://phab.mercurial-scm.org/D10652
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 21:04:55 +0200] rev 47254
revlog: add a `_get_decompressor` method
This logic is non-trivial and we will need to reuse it.
Differential Revision: https://phab.mercurial-scm.org/D10651
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 19:46:25 +0200] rev 47253
revlog: introduce a plain compression mode
That mode is simple it means the chunk contains uncompressed data and can be
used directly.
Differential Revision: https://phab.mercurial-scm.org/D10650
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 20:22:34 +0200] rev 47252
revlog: use an intermediate variable for `data` in `_chunk`
This will help us to dispatch this to the right decompressor.
Differential Revision: https://phab.mercurial-scm.org/D10649
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 18:41:51 +0200] rev 47251
revlogv2: preserve the compression mode on disk
The value is still the same and still not treated, but now it exists one disk.
Differential Revision: https://phab.mercurial-scm.org/D10648
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 01:49:37 +0200] rev 47250
revlog: use `format_version` to dispatch different version in index_get
This is semantically more correct.
Differential Revision: https://phab.mercurial-scm.org/D10647
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 18:19:16 +0200] rev 47249
revlog: add a "data compression mode" entry in the index tuple
That will make it possible to keep track of compression information in the
revlog index, opening the way to more efficient revision restoration (in native
code, but the python usage is already defeating performance work).
We start with adding a new entry to the index tuple, using a value matching the
current behavior. We will introduce storage and other value in later changesets.
Differential Revision: https://phab.mercurial-scm.org/D10646
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 01:15:03 +0200] rev 47248
revlog: fix the `null_item` attribute for V0
This is not a proper index tuple.
Differential Revision: https://phab.mercurial-scm.org/D10645
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 01:13:53 +0200] rev 47247
revlog: create a create `null_item` attribute for V0
This value is currently wrong, but at least it is now -obviously- wrong.
Differential Revision: https://phab.mercurial-scm.org/D10644
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 16:52:38 +0200] rev 47246
revlog: improve documentation of the entry tuple
The code in revlog, and outside revlog directly use the index's entry tuple,
with direct integer indexing. This is a voluntary trade off to obtains better
performance from the Python code at the expense of the developers sanity.
Let's at least have a clear and central documentation about what this tuple is
about.
Differential Revision: https://phab.mercurial-scm.org/D10643
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 23:45:05 +0200] rev 47245
revlog: simplify entry update logic in `rewrite_sidedata`
We don't need to rebuild the full entry. So lets just gather the data we need
to pass to `replace_sidedata_info`.
Differential Revision: https://phab.mercurial-scm.org/D10642
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 04 May 2021 00:02:48 +0200] rev 47244
revlog: simplify the replace_sidedata_info code
We already know how to serialize and de-serialize and enty. So lets just do that
and modify the entry tuple directly.
This avoid having to duplicated binary operation in complicated code.
Differential Revision: https://phab.mercurial-scm.org/D10641
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 23:59:15 +0200] rev 47243
revlog: use `rev` instead of `i` in replace_sidedata_info
This is clearer.
Differential Revision: https://phab.mercurial-scm.org/D10640
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:35:35 +0200] rev 47242
revlogv2: also keep track for the size of the "data" file
This is useful to make sure we always start writing at the right location,
without effort.
Differential Revision: https://phab.mercurial-scm.org/D10632
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:35:25 +0200] rev 47241
revlogv2: track pending write in the docket and expose it to hooks
The docket is now able to write pending data. We could have used a distinct
intermediate files, however keeping everything in the same file will make it
simpler to keep track of the various involved files if necessary.
However it might prove more complicated for streaming clone. This will be dealt
with later.
Note that we lifted the stderr redirection in the test since we no longer suffer
from "unkown working directory parent" message.
Differential Revision: https://phab.mercurial-scm.org/D10631
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:35:14 +0200] rev 47240
revlog: move the `trypending` logic from the `changelog` to the `revlog`
We move the -reading- logic for the pending's '.a' suffixed index within the
revlog class. This is motivated by the fact the logic could be simpler and
cleaner if directly handled by the revlog docket. Before we can do so, we need
to teach the revlog code about reading "pending" changes. To be honest, we
already needed some special casing of the `.a` postfix, so this does not adds
much complexity.
The logic around -writing- the special '00changelog.i.a' remains in the
`changelog` class. Note that the revlog-v2 logic no longer use this logic.
The only remaining user of the `postfix` argument is the `censor` logic. We
could probably also make the revlog full aware of it (most of the code is
already implemented in revlog anyway) and get rid of the `postfix` argument and
logic. However this is an adventure for another time.
Since we have more information, we add more, paranoid, Programming error in case
we detect such "pending reader" trying to do a read (which does not happens
anyways).
Differential Revision: https://phab.mercurial-scm.org/D10630
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:35:02 +0200] rev 47239
revlogv2: delay the update of the changelog docket to transaction end
This prevent external reader to see the transaction content before it is
commited. However this also prevent the hooks to see the transaction content.
We will fix this in later changesets.
We have to temporarily suppress the error output of the command ran during the
transaction as they sometimes get confused about unknown working directory and
sometimes issue message on std-err in unspecified order.
Differential Revision: https://phab.mercurial-scm.org/D10629