Arseniy Alekseyev <aalekseyev@janestreet.com> [Tue, 07 Dec 2021 18:57:43 +0000] rev 48497
rhg: fix a crash on non-generaldelta revlogs
Differential Revision: https://phab.mercurial-scm.org/D11882
Arseniy Alekseyev <aalekseyev@janestreet.com> [Tue, 07 Dec 2021 18:12:13 +0000] rev 48496
rhg: centralize index header parsing
Centralize index header parsing, parse the generaldelta flag,
and leave breadcrumbs to relate the code to python.
Differential Revision: https://phab.mercurial-scm.org/D11881
Arseniy Alekseyev <aalekseyev@janestreet.com> [Tue, 07 Dec 2021 17:50:19 +0000] rev 48495
rhg: demonstrate that rhg breaks on non-generaldelta revlogs
Differential Revision: https://phab.mercurial-scm.org/D11880
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Dec 2021 23:08:25 +0100] rev 48494
tests: add a short `sleep` in test-status.t
With dirstate-v2 and rhg both enabled, this test would sometimes fail for me
with:
```
--- tests/test-status.t
+++ tests/test-status.t#dirstate-v2.err
@@ -943,7 +943,7 @@
$ rm subdir/unknown
$ hg status
$ hg debugdirstate --all --no-dates | grep '^ '
- 0 -1 set subdir
+ 0 -1 unset subdir
```
Meaning that `status` did not write a directory mtime in the dirstate
as expected. This can happen if the observed mtime of the directory is
the same as "current time" at the start of `status`. This current time
is obtained by creating a temporary file and checking its mtime.
Even with ext4 on my system being able to store nanosecond precision,
identical mtime for successive but separate operations is still possible
becuse the kernel may cache the current time:
https://stackoverflow.com/a/14393315/1162888
0.1 second should be enough for this cache to be updated, without
significantly slowing down the test.
Differential Revision: https://phab.mercurial-scm.org/D11900
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Dec 2021 16:18:58 +0100] rev 48493
rhg: Add support for `rhg status --copies`
Copy sources are collected during `status()` rather than after the fact like
in Python, because `status()` takes a `&mut` exclusive reference to the dirstate map
(in order to potentially mutate it for directory mtimes) and returns `Cow<'_, HgPath>`
that borrow the dirstate map.
Even though with `Cow` only some shared borrows remain, the still extend the same
lifetime of the initial `&mut` so the dirstate map cannot be borrowed again
to access copy sources after the fact:
https://doc.rust-lang.org/nomicon/lifetime-mismatch.html#limits-of-lifetimes
Additionally, collecting copy sources during the dirstate tree traversal that
`status()` already does avoids the cost of another traversal or other lookups
(though I haven’t benchmarked that cost).
Differential Revision: https://phab.mercurial-scm.org/D11899
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Dec 2021 16:57:39 +0100] rev 48492
rhg: refactor relativize_path into a struct + method
… instead of a function that takes an iterator and a callback.
Differential Revision: https://phab.mercurial-scm.org/D11898
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Dec 2021 16:31:16 +0100] rev 48491
rhg: refactor display_status_paths with a struct for common arguments
Differential Revision: https://phab.mercurial-scm.org/D11897
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Dec 2021 14:27:00 +0100] rev 48490
rhg: Add support for ui.ignore and ui.ignore.* config
This fixes some but not all failures in `tests/test-hgignore.t` when running
with `rhg status` enabled.
Differential Revision: https://phab.mercurial-scm.org/D11907
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 10 Dec 2021 17:20:21 +0100] rev 48489
doc: remove a spurious ^L in some doc
This was wrongly introduced in D11784.
Differential Revision: https://phab.mercurial-scm.org/D11896
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 21:30:32 +0100] rev 48488
upgrade: drop some dead code
Everything done by this block is now done by earlier code. So we don't need it anymore.
Differential Revision: https://phab.mercurial-scm.org/D11872
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 17:54:39 +0100] rev 48487
upgrade: only process revlogs that needs it by default
We have more and more requirement that does not affect revlog or that only
affect some of them. It is silly to force a full processing of all revlog to
juste move the requirement around, or to simply rewrite the dirstate.
So now, only the revlog that needs to be touched will be touched. Unless the
--changelog & al flags are used.
Differential Revision: https://phab.mercurial-scm.org/D11871
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 17:13:26 +0100] rev 48486
upgrade: issue a message when a revlog type has to be upgraded
This is more explicite and prepare for a smoother transition to smarter picking
of the revlog we will process.
Differential Revision: https://phab.mercurial-scm.org/D11870
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 17:12:21 +0100] rev 48485
upgrade: explicitly warn when a `--no-xxx` flag is overwritten
Some format upgrade/downgrades -needs- revlog to be recomputed. So we now
detect that individually and warn when it contradict explicitly passed flag.
This is part of a larger series to make `debugupgraderepo` smarter about which
revlog it picks by default.
Differential Revision: https://phab.mercurial-scm.org/D11869
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 14:40:13 +0100] rev 48484
upgrade: make the list of explicitly specified revlog a dict
This makes various logic simpler and will help making future patch clearer.
Differential Revision: https://phab.mercurial-scm.org/D11868
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Dec 2021 11:59:48 +0100] rev 48483
upgrade: move the revlog selection code lower down the chain
We about about to make revlog section smarter. Moving the code around will make
the next changesets clearer.
Differential Revision: https://phab.mercurial-scm.org/D11867
Simon Sapin <simon.sapin@octobus.net> [Thu, 09 Dec 2021 10:55:17 +0100] rev 48482
rhg: Set second_ambiguous as needed in post-status fixup
This fixes an intermittent bug that manifested only in test-revert.t,
and unfortunately not on CI. On a fast enough machine we could have:
1. A file is modified
2. `rhg status` writes an updated dirstate-v1
3. The same file is modified again
… all within the same integer second. Because the dirstate-v1 file format
does not store sub-second precision, step 2 must write the file’s mtime
as "unknown" because of the possibility of step 3.
However, most of the code now handles timestamps with nanosecond precision
in order to take advantage of it in dirstate-v2. `second_ambiguous` must
be set for timestamps that become ambiguous if sub-second precision is dropped
(such as through serialization in dirstate-v1 format).
Differential Revision: https://phab.mercurial-scm.org/D11889
Simon Sapin <simon.sapin@octobus.net> [Thu, 09 Dec 2021 10:23:41 +0100] rev 48481
dirstate: Document Timestamp.second_ambiguous
Differential Revision: https://phab.mercurial-scm.org/D11888
Raphaël Gomès <rgomes@octobus.net> [Tue, 07 Dec 2021 12:34:58 +0100] rev 48480
rhg: support the new extension suboptions syntax
See inline comments
Differential Revision: https://phab.mercurial-scm.org/D11874
Raphaël Gomès <rgomes@octobus.net> [Wed, 08 Dec 2021 10:14:37 +0100] rev 48479
branching: merge stable into default
Martin von Zweigbergk <martinvonz@google.com> [Mon, 06 Dec 2021 12:30:54 -0800] rev 48478
filemerge: remove `premerge` argument from `_makebackup()`
We now always pass `True`, so there's no need to pass it.
Differential Revision: https://phab.mercurial-scm.org/D11863
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 22:45:35 -0800] rev 48477
filemerge: inline `_filemerge()` into `filemerge()`
The caller is now trivial, so the indirection is pointless.
Differential Revision: https://phab.mercurial-scm.org/D11860
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 21:41:43 -0800] rev 48476
filemerge: make `_filemerge()` do both premerge and merge
This patch removes the `premerge` argument from `_filemerge()` and
makes it do both the "premerge" and "merge" steps without the caller
having to call it twice.
Differential Revision: https://phab.mercurial-scm.org/D11859
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 16:21:46 -0800] rev 48475
filemerge: merge `premerge()` into `filemerge()`
Differential Revision: https://phab.mercurial-scm.org/D11858
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 15:43:54 -0800] rev 48474
mergestate: inline `_resolve()` into `resolve()`
The caller is now trivial, so the indirection is pointless.
Differential Revision: https://phab.mercurial-scm.org/D11857
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 13:53:02 -0800] rev 48473
mergestate: make `_resolve()` do both preresolve and resolve
This patch removes the `preresolve` argument from `_resolve()` and
makes it do both the "preresolve" and "resolve" steps without the
caller having to call it twice.
Differential Revision: https://phab.mercurial-scm.org/D11856
Martin von Zweigbergk <martinvonz@google.com> [Thu, 02 Dec 2021 22:59:36 -0800] rev 48472
mergestate: merge `preresolve()` into `resolve()`
The separation between `preresolve()` and `resolve()` was something
added for the "merge driver" feature. Since we removed that in
32ce4cbaec4b (mergedriver: delete it, 2020-09-17), we don't need the
separation anymore. More cleanups will follow.
Differential Revision: https://phab.mercurial-scm.org/D11855
Martin von Zweigbergk <martinvonz@google.com> [Fri, 03 Dec 2021 21:50:25 -0800] rev 48471
tests: remove unnecessary explicit args from `failfilemerge.py`
The `failfilemerge()` function always raises an exception without
looking at its arguments, so let's use `*args` and `**kwargs`.
Differential Revision: https://phab.mercurial-scm.org/D11854
Martin von Zweigbergk <martinvonz@google.com> [Mon, 29 Nov 2021 23:00:29 -0800] rev 48470
simplemerge: set `conflicts` earlier for :union tool
Differential Revision: https://phab.mercurial-scm.org/D11853
Raphaël Gomès <rgomes@octobus.net> [Fri, 26 Nov 2021 11:53:54 +0100] rev 48469
typo: s/unkown/unknown across the codebase
Differential Revision: https://phab.mercurial-scm.org/D11807
Simon Sapin <simon.sapin@octobus.net> [Thu, 25 Nov 2021 18:33:51 +0100] rev 48468
rhg: Update the dirstate on disk after status
Differential Revision: https://phab.mercurial-scm.org/D11840
Simon Sapin <simon.sapin@octobus.net> [Thu, 02 Dec 2021 15:10:03 +0100] rev 48467
rhg: Add Repo::write_dirstate
This method is not used yet. It saves to disk any mutation that was done to
the `Repo`’s dirstate through `Repo::dirstate_map_mut`. It takes care of
dirstate-v1 v.s. dirstate-v2, dockets, data files, appending when possible,
etc.
Differential Revision: https://phab.mercurial-scm.org/D11839
Simon Sapin <simon.sapin@octobus.net> [Thu, 02 Dec 2021 12:05:36 +0100] rev 48466
rhg: Add lazy/cached dirstate data file ID parsing on Repo
The `dirstate_parents`, `dirstate_data_file_uuid`, and `dirstate_map` members
of `Repo` can be access in any order and the `.hg/dirstate` file should only
be opened once.
Differential Revision: https://phab.mercurial-scm.org/D11838
Simon Sapin <simon.sapin@octobus.net> [Mon, 29 Nov 2021 19:00:11 +0100] rev 48465
rhg: Make Repo::dirstate_parents a LazyCell
Unify with the same abstraction used for other lazily-initialized components
Differential Revision: https://phab.mercurial-scm.org/D11837
Simon Sapin <simon.sapin@octobus.net> [Mon, 29 Nov 2021 18:46:04 +0100] rev 48464
rust: Add Vfs::write_atomic
This method writes to a temporary file then renames in place
Differential Revision: https://phab.mercurial-scm.org/D11836
Simon Sapin <simon.sapin@octobus.net> [Mon, 22 Mar 2021 09:07:10 +0100] rev 48463
rhg: Initial repository locking
Initial Rust implementation of locking based on the `.hg/wlock` symlink (or file),
with lock breaking when the recorded pid and hostname show that a lock was
left by a local process that is not running anymore (as it might have been
killed).
Differential Revision: https://phab.mercurial-scm.org/D11835
Simon Sapin <simon.sapin@octobus.net> [Mon, 29 Nov 2021 17:37:08 +0100] rev 48462
rust: Serializing a DirstateMap does not mutate it anymore
Differential Revision: https://phab.mercurial-scm.org/D11834
Raphaël Gomès <rgomes@octobus.net> [Fri, 26 Nov 2021 15:07:59 +0100] rev 48461
rhg: don't run `blackbox` if not activated
You currently have no way of turning off blackbox. Aside from being a bug, this
can be annoying if you use `rhg` in your shell prompt, but also because the
current implementation of blackbox is quite slow due to `user` querying.
Differential Revision: https://phab.mercurial-scm.org/D11813
Raphaël Gomès <rgomes@octobus.net> [Fri, 26 Nov 2021 15:05:58 +0100] rev 48460
rust: add function to check if an extension is enabled
This will be used in the next patch
Differential Revision: https://phab.mercurial-scm.org/D11812
Raphaël Gomès <rgomes@octobus.net> [Fri, 03 Dec 2021 15:06:40 +0100] rev 48459
dirstate: remove unused method
Its last usage was inlined in `merge.py`.
Differential Revision: https://phab.mercurial-scm.org/D11849
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 04 Dec 2021 03:51:33 +0100] rev 48458
python2-compat: fix extensions' tests on python2
They are minor output different to be taken in account.
Differential Revision: https://phab.mercurial-scm.org/D11861
Arseniy Alekseyev <aalekseyev@janestreet.com> [Tue, 16 Nov 2021 11:53:58 +0000] rev 48457
rhg: add support for narrow clones and sparse checkouts
This adds a minimal support that can be implemented without parsing the narrowspec.
We can parse the narrowspec and add support for more operations later.
The reason we need so few code changes is as follows:
Most operations need no special treatment of sparse because
some of them only read dirstate (`rhg files` without `-r`),
which bakes in the filtering,
some of them only read store (`rhg files -r`, `rhg cat`),
and some of them read no data at all (`rhg root`, `rhg debugrequirements`).
`status` is the command that might care about sparse, so we just disable
rhg on it.
For narrow clones, `rhg files` clearly needs the narrowspec to work
correctly, so we fall back.
`rhg cat` seems to work consistently with `hg cat` if the file exists.
If the file is hidden by narrow spec, the error message is different and confusing, so
that's something that we should improve in follow-up patches.
Differential Revision: https://phab.mercurial-scm.org/D11764
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 03 Dec 2021 14:36:40 +0100] rev 48456
update: reformat the `commands.update.check` help
This make the various option clearer.
Differential Revision: https://phab.mercurial-scm.org/D11852
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 03 Dec 2021 12:03:23 +0100] rev 48455
update: properly overwrite `check` config with `--no-` variants
Before this change `--merge` override `commands.update.check=abort/noconflict`,
and `--check` "override" `commands.update.check=none/linear`. However the
`--no-merge` and `--no-check` version where not doing anything.
The `--no-` two flags now behave properly.
Differential Revision: https://phab.mercurial-scm.org/D11851
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 03 Dec 2021 12:19:36 +0100] rev 48454
update: add a test for `--merge` overriding the "abort" config
I don't see this behavior tested anywhere.
Differential Revision: https://phab.mercurial-scm.org/D11850
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 03 Dec 2021 12:01:00 +0100] rev 48453
update: use long version of the flag in the test
This helps readability and searchability.
Differential Revision: https://phab.mercurial-scm.org/D11848
Raphaël Gomès <rgomes@octobus.net> [Mon, 22 Nov 2021 10:47:12 +0100] rev 48452
backout: backed out changeset 5d83a40cd3f8
This is the re-send of the backout in D11757 that I accidentally queued. I'll
rewrite the original commit message:
...sigh
We do not have Python 3 packaging for thg on Windows where the vast majority of
of users use the thg installer for Mercurial. Until this is done (hopefully
this cycle), we're keeping Python.
(end of the old commit message)
On top of this, we have a solid lead to have competent people take care of this
packaging issue for us in time for the 6.1 release, which is really the main
reason for us to wait. We're trying our best to make this work, so please bear
with us.
Differential Revision: https://phab.mercurial-scm.org/D11770
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 05:00:28 +0100] rev 48451
status: keep second-ambiguous mtimes during fixup
Now that we support the feature, we can keep "second ambiguous" mtime during the fixup phase.
These are the mtime that would be ambiguous if we did not had sub-second précions.
See the v2 format documentation for details.
Differential Revision: https://phab.mercurial-scm.org/D11847
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 04:43:57 +0100] rev 48450
dirstate-item: make sure we load `mtime-second-ambiguous` from disk
Now that we support the associated logic, we can safely load it from it. It is
no longer necessary to ignore the stored mtime when the flag is encountered.
Differential Revision: https://phab.mercurial-scm.org/D11846
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 05:00:06 +0100] rev 48449
dirstate-item: make sure we set the mtime-second-ambiguous on v2 write
We want to preserve the second-ambiguity alongside the ambiguous mtime. So we
use the decimated flag for that.
note: the C code was already doing so. No change was needed to it.
Differential Revision: https://phab.mercurial-scm.org/D11845
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 04:59:48 +0100] rev 48448
dirstate-item: ignore mtime to write v1 when `mtime-second-ambiguous` is set
We cannot preserve that information in the v1 format so that mtime is ambiguous.
Differential Revision: https://phab.mercurial-scm.org/D11844
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 04:51:05 +0100] rev 48447
dirstate-item: implement the comparison logic for mtime-second-ambiguous
If the flag is set we now process it properly.
We "just" need to actually set it and persist it.
Differential Revision: https://phab.mercurial-scm.org/D11843
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 24 Nov 2021 04:40:00 +0100] rev 48446
dirstate-item: add a "second_ambiguous` flag in the mtime tuple
This will be used to support the `mtime-second-ambiguous` flag from dirstate
v2. See format documentation for details.
For now, we only make it possible to store the information, no other logic have
been added.
Differential Revision: https://phab.mercurial-scm.org/D11842
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 23 Nov 2021 19:27:17 +0100] rev 48445
dirstate: drop comparison primitive on the timestamp class
All comparison are now managed without using operator :
- the status mtime comparisons is handled by the DirstateItem,
- the fixup reliability check,
- the update "hack".
So we no longer needs the operator and should discourage its usage.
Differential Revision: https://phab.mercurial-scm.org/D11841
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 23 Nov 2021 18:13:33 +0100] rev 48444
largefile: use the proper "mtime boundary" logic during fixup
This will prevent ambiguous cache entry to be used in racy situation. This fix
flakiness in test and some real live misbehavior.
Differential Revision: https://phab.mercurial-scm.org/D11800
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 23 Nov 2021 18:03:51 +0100] rev 48443
status: move the boundary comparison logic within the timestamp module
Some extensions will need it too. So lets isolate the logic. It also makes
things clearer.
Differential Revision: https://phab.mercurial-scm.org/D11799
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 23 Nov 2021 18:11:42 +0100] rev 48442
tests: remove potential mtime ambiguity in a dirstate test
If the test was fast enough, some mtime where not stored. We now wait long
enough to ensure the mtime is no longer ambiguous.
Differential Revision: https://phab.mercurial-scm.org/D11798
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 19 Nov 2021 03:03:01 +0100] rev 48441
dirstate: cleanup remaining of "now" during write
Since the whole `need_delay` have been removed, we no longer need this.
Differential Revision: https://phab.mercurial-scm.org/D11797
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 19 Nov 2021 03:04:42 +0100] rev 48440
dirstate: remove need_delay logic
Now that all¹ stored mtime are non ambiguous, we no longer need to apply the `need_delay` step.
The need delay logic was not great are mtime gathered during longer operation
could be ambiguous but younger than the `dirstate.write` call time.
So, we don't need that logic anymore and can drop it
This make the code much simpler. The code related to the test extension faking
the dirstate write is now obsolete and associated test will be migrated as
follow up. They currently do not break.
[1] except the ones from `hg update`, but `need_delay` no longer help for them
either.
Differential Revision: https://phab.mercurial-scm.org/D11796
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 25 Oct 2021 11:36:22 +0200] rev 48439
dirstate: remove `lastnormaltime` mechanism
This is now redundant with the new, simpler `mtime_boundary` one.
Differential Revision: https://phab.mercurial-scm.org/D11795
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 18 Nov 2021 13:12:40 +0100] rev 48438
status: use filesystem time boundary to invalidate racy mtime
We record the filesystem time at the start of the status walk and use that as a
boundary to detect files that might be modified during (or right after) the
status run without the mtime allowing that edition to be detected. We
currently do this at a second precision. In a later patch, we will use
nanosecond precision when available.
To cope with "broken" time on the file system where file could be in the
future, we also keep mtime for file over one day in the future. See inline
comment for details.
Large file tests get a bit more confused as we reduce the odds for race
condition.
As a "side effect", the win32text extension is happy again.
Differential Revision: https://phab.mercurial-scm.org/D11794