Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 19:46:39 +0100] rev 50044
test: explicitly "add" file before some commit in test-filecache.py
`hg commit -A` will revert the `hg addremove` step if the commit fails. However
`hg rollback` currently does not.
We are about to improve internal consistency around transaction and dirstate and the behavior of `hg rollback` will align on the other behavior in the process.
Before doing so, we make sure the test is using a separate call to `hg add` to
avoid the test scenario to be affected by that future change.
note: the behavior change for `hg rollback` seems fine as it affect a niche
usecase and `hg rollback` usage have been strongly discouraged for a while.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 17:42:10 +0100] rev 50043
test: explicitly "add" file before some commit in test-bookmark.t
`hg commit -A` will revert the `hg addremove` step if the commit fails. However
`hg rollback` currently does not.
We are about to improve internal consistency around transaction and dirstate and the behavior of `hg rollback` will align on the other behavior in the process.
Before doing so, we make sure the test is using a separate call to `hg add` to
avoid the test scenario to be affected by that future change.
note: the behavior change for `hg rollback` seems fine as it affect a niche
usecase and `hg rollback` usage have been strongly discouraged for a while.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 17:42:32 +0100] rev 50042
test: explicitly "add" file before some commit in test-rollback.t
`hg commit -A` will revert the `hg addremove` step if the commit fails. However
`hg rollback` currently does not.
We are about to improve internal consistency around transaction and dirstate and the behavior of `hg rollback` will align on the other behavior in the process.
Before doing so, we make sure the test is using a separate call to `hg add` to
avoid the test scenario to be affected by that future change.
note: the behavior change for `hg rollback` seems fine as it affect a niche
usecase and `hg rollback` usage have been strongly discouraged for a while.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 17:30:55 +0100] rev 50041
rhg-files: add support for narrow when specifying a revision
This makes it so that `rhg files -r NODE` works properly when using narrow.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 17:08:23 +0100] rev 50040
rust-narrow: enable narrow support for plain `rhg files`
Support for `rhg files -r NODE` in a future changeset.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 17:28:48 +0100] rev 50039
rhg-files: make signature of `display_files` more flexible
This allows the callers to use any error type that converts to `CommandError`
instead of a particular concrete type.
Raphaël Gomès <rgomes@octobus.net> [Thu, 12 Jan 2023 10:28:56 +0100] rev 50038
rhg: fix user-facing error message so it matches Python implementation
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 16:42:29 +0100] rev 50037
rust-ui: refactor ui code for printing narrow/sparse warnings
This will be used elsewhere in the code, starting from the next commit.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 16:29:29 +0100] rev 50036
rhg-files: reuse centralized dirstate logic
The `files` logic predates the centralized dirstate logic. It was duplicated,
an didn't receive bugfixes along the way.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 17:27:19 +0100] rev 50035
rust: move `filter_map_results` to public util
This is a useful general-purpose function.
It will be used in the next changesets.
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Jan 2023 15:44:21 +0100] rev 50034
rhg: fix typo
Matt Harbison <matt_harbison@yahoo.com> [Fri, 03 Feb 2023 17:31:54 -0500] rev 50033
run-tests: stop ignoring venv-installed packages
This will allow test dependencies to be installed within a venv, instead of
tampering with sys/user sites. One thing to note here is that the `VIRTUAL_ENV`
path takes precedence over system-site, unlike when run directly with an
activated `venv`. For example, `sys.path` as viewed from a feature test in
`hghave.py`, when running `hghave vcr` directly with an activated `venv`:
sys.path: [
'/home/jenkins/hg-committed/tests',
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/usr/lib/python3.8/lib-dynload',
'/home/jenkins/test_venv/lib/python3.8/site-packages'
]
vs `sys.path` from the same feature test, when run by `run-tests.py` with this
change:
sys.path: [
'/home/jenkins/hg-committed/tests',
'/home/jenkins/hg-committed',
'/home/jenkins/hg-committed/tests',
'/home/jenkins/test_venv/lib/python3.8/site-packages',
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/usr/lib/python3.8/lib-dynload',
'/home/jenkins/.local/lib/python3.8/site-packages',
'/usr/local/lib/python3.8/dist-packages',
'/usr/lib/python3/dist-packages'
]
Matt Harbison <matt_harbison@yahoo.com> [Mon, 30 Jan 2023 16:59:15 -0500] rev 50032
bundlerepo: raise `error.LookupError` instead of `LookupError`
I'm pretty sure that this was the intention, given `error.LookupError` is raised
a few lines above with the same arguments.
Note that PyCharm complains about `self.display_id` (and the use above this too)
being `() -> Any` instead of `bytes`, but it may be confused about the
`util.propertycache` annotation on it.
Matt Harbison <matt_harbison@yahoo.com> [Mon, 30 Jan 2023 16:49:41 -0500] rev 50031
unionrepo: resync several methods to actually override superclass methods
Not sure how/when these skewed, but these were flagged by PyCharm as having
different signatures.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 31 Jan 2023 11:41:59 +0100] rev 50030
branching: merge with stable
Joerg Sonnenberger <joerg@bec.de> [Thu, 29 Apr 2021 22:01:04 +0200] rev 50029
storageutil: match node length with repository
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 12:50:52 +0100] rev 50028
dirstate: enforce holding the lock while doing any changes
This seems like a sensible sanity check. This already caught the issue in
largefile. This will catch more issue when we start using similar context
manager for operation other than the parent changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Jan 2023 00:45:07 +0100] rev 50027
largefile: make sure we hold the lock when updating the second dirstate
The largefile extension uses a second dirstate file (and object) to track some
states. In some situations, it is lazily updated when needed. These operations
might not have the lock taken. This means they might conflict and race with
other ongoing operations.
So we now take the lock to do these operations.
This was caught by the next commit.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:19:39 +0100] rev 50026
dirstate: rename `@requires_no_parents_change` too
This match the rename of the context manager.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:17:29 +0100] rev 50025
dirstate: rename `@requires_parents_change` to `@requires_changing_parents`
This match the rename of the context manager.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 12:10:37 +0100] rev 50024
dirstate: write dirstate on successful exit of changing_parents context
This is the first step toward having more sensible and predicatable write
patterns for the dirstate. Having better write/rollback patterns will greatly
reduce and clarify the needs to backup the dirstate.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 19:12:31 +0100] rev 50023
dirstate: rename parentchange to changing_parents
Since the new argument breaks the API anyway, we can rename it to a better name.
The previous name `parentchange` might be seen as something active, a function
that would directly change the parents, however this is just a context manager
to frame the operation that will change the parents and adjust the
dirstate content accordingly.
In addition, the future sister method that will be about changes to tracking and
files would have a hard time fitting in the same naming scheme in a clear way.
The new naming uses a clear prefix will make it more distinct from other
dirstate methods and easier to extend with other similar contexts.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 18:46:20 +0100] rev 50022
dirstate: pass the repo to the `changeparent` method
If we want the context to be responsible for writing (and we want it), we need
to have access to a localrepository object.
So we now requires a localrepository object as an argument to this context
manager.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 10:00:04 +0100] rev 50021
dirstate: warn about non-explicitly rolledback parent-change
Now that the invalidation is dealt with by the context manager itself, we
should no longer need this in the unlocking code. We start with issuing a
warning if this is the case before actually dropping this code later.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 11:39:44 +0100] rev 50020
dirstate: invalidate changes when parent-change fails
When an error occurs during changing parents, we should invalidate all dirstate
modifications and reload the dirstate. This is currently done by a `unlock`
callback on the `wlock`.
To fix this anomaly, we start dealing with the error directly in the context
manager and its potential nesting.
The "hard" part is to make sure that, when the parent-change context are nested,
we and higher level nesting do not continue to use the invalidated dirstate.
We introduce dedicated code to enforce that.
Cédric Krier <ced@b2ck.com> [Sat, 28 Jan 2023 20:08:57 +0100] rev 50019
setup: Ensure target directory exists with building rust extension
When the rust extension is the first to be build, the target directory may not
exist so the copy fails.
Cédric Krier <ced@b2ck.com> [Thu, 26 Jan 2023 00:23:07 +0100] rev 50018
filemerge: add union-other-first as internal merge tool
See inline documentation for details.
Raphaël Gomès <rgomes@octobus.net> [Fri, 13 Jan 2023 00:07:07 +0100] rev 50017
rust: use `peek_mut` from the standard lib now that it's stable
Just a little cleanup of a TODO found along the way.
Raphaël Gomès <rgomes@octobus.net> [Wed, 25 Jan 2023 18:45:38 +0100] rev 50016
clippy: actually fail if there are any warnings
So far, only errors would trip the CI, this makes it so all warnings are
elevated to errors, making it a CI fail if any warnings are present.
This was the intended behavior, I just missed this when adding clippy.
Raphaël Gomès <rgomes@octobus.net> [Wed, 25 Jan 2023 18:44:09 +0100] rev 50015
rust-clippy: fix warning about nested ifs
Arun Kulshreshtha <akulshreshtha@janestreet.com> [Thu, 19 Jan 2023 11:12:20 -0500] rev 50014
debugshell: allow commands to be specified as a CLI argument
Add a `--command` option to `hg debugshell` that allows the user to pass in
Python code to evaluate directly from the command line. This was inspired by
the `--command` option present in Facebook's Sapling fork of Mercurial,
which in turn was inspired by the `-c` option of the Python interpreter
itself. It is particularly useful for writing tests, especially for getting
visibility into things that otherwise aren't exposed via debug commands.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:40:19 +0100] rev 50013
heptapod-ci: add `clippy` to the CI
This linter mostly makes our code more idiomatic, less surprising, has good
suggestions and catches bugs. It's widely used in the Rust community and now
part of the default toolchain when using `rustup`.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:39:53 +0100] rev 50012
makefile: add `cargo clippy` to tests if cargo is available
This linter mostly makes our code more idiomatic, less surprising, has good
suggestions and catches bugs. It's widely used in the Rust community and now
part of the default toolchain when using `rustup`.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:25:24 +0100] rev 50011
rust-tests: run `cargo` tests inside the `rust` folder
There is no reason to only run inside the `rust/hg-cpython` folder, even if
the `cargo test --all` behavior ends up being the same.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:20:54 +0100] rev 50010
rust-clippy: merge "revlog" module definition and struct implementation
Module inception is confusing when looking for code and almost never
the right choice.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:57:15 +0100] rev 50009
rust-clippy: merge "config" module definition and struct implementation
Module inception is confusing when looking for code and almost never
the right choice.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:45:38 +0100] rev 50008
rust-clippy: upgrade `bytes-cast` dependency
I released a new version of `bytes-cast` to get rid of the clippy warning,
and bump to edition 2021, so let's use it.
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:41:52 +0100] rev 50007
rust-clippy: remove redundant suffix from enum
Same as last time, this makes the code clearer in this instance.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:37:05 +0100] rev 50006
rust-clippy: fix remaining warnings in `hg-cpython`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:36:41 +0100] rev 50005
rust-clippy: disable some lints crate-wide for `hg-cpython`
`rust-cpython` creates some pretty funky code that also needs to be compatible
with pretty old Rust. This makes clippy quite useless in `hg-cpython` unless
you disable the lints that are always triggered by `py_class!` and related.
Maybe `clippy` will allow one day to exclude a dependency from its linting,
but this seems quite unlikely, so this is the best we've got at the moment.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:32:35 +0100] rev 50004
rust-clippy: fix remaining warnings in `rhg`
All of these are simple changes that for the most part are clear improvements
and the rest are at most equivalent.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:18:43 +0100] rev 50003
rust-clippy: fix most warnings in `hg-core`
All of these are simple changes that for the most part are clear improvements
and the rest are at most equivalent.
The remaining warnings have to be fixed either with a bigger refactor like for
the nested "revlog" module, or in the dependency `bytes-cast`, which we own.
This will be done sometime in the future.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:14:14 +0100] rev 50002
rust-utils: strip redundant prefix from enum
This was highlighted by `clippy`, I think this makes the code cleaner.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:07:44 +0100] rev 50001
rust-filepatterns: don't `Box` subincludes unnecessarily
This was caught by `clippy`.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:58:18 +0100] rev 50000
rust-nodemap: implement `PartialEq` without allocation
This was caught by `clippy`. It's probable that this ends up optimized out
by the compiler, but let's not rely on that.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:54:57 +0100] rev 49999
rust-clippy: tell `clippy` we don't need to declare a default here
This is a struct only useful for tests.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:50:29 +0100] rev 49998
rust-clippy: refactor complex type
This makes reading the signature a bit less tiring.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:30:42 +0100] rev 49997
rust-clippy: simplify return type of debug function
This makes the type a little bit more readable.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:27:53 +0100] rev 49996
rust-clippy: add `is_empty` method to please the `clippy` gods
I can see it being useful anyway.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:25:24 +0100] rev 49995
rust: don't use a reference to a `Cow`
This was caught by `clippy`.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:22:46 +0100] rev 49994
rust-clippy: reassure `clippy` that 8 arguments is expected
This API is a bit verbose, but refactoring it into a struct isn't better
in this particular case IMO, and there is a lot of info to pass.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:15:29 +0100] rev 49993
rust-clippy: use `write_all` since we're not expecting a partial write
Clippy caught this. This is a good lint in general, but here this was not
really a bug in this example code.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:09:26 +0100] rev 49992
rust-clippy: tell clippy we want to keep those clauses separate
This makes the cases more explicit, which is wanted in this specific instance.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:04:29 +0100] rev 49991
rust-clippy: tell clippy we care about keeping those `if` clauses separate
Thses were written this way because it spells out the logic in a more
explicit manner.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:03:24 +0100] rev 49990
rust-clippy: factor an `if` with the same duplicated clause
Unlike the next changeset, this if is not really made clearer by keeping the
cases separate.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:00:56 +0100] rev 49989
rust: fix broken debug assertions
These were caught by `clippy`. It appears no one uses the debug builds, which
is how this wasn't caught before.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 17:48:54 +0100] rev 49988
rust-narrow: fix loop that never loops
This was caught by `clippy`. I guess the narrow tests leave something to be
desired, since this previously only checked the first valid pattern.
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 17:40:03 +0100] rev 49987
rust: run `cargo clippy`
These automatic fixes are good to have because they make the code
more idiomatic and less surprising.
The transform from `sort` -> `sort_unstable` is questionable, but this is
only in a test, so it doesn't matter in our case.
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Jan 2023 18:52:04 +0100] rev 49986
rust: use `logging_timer` instead of `micro_timer`
I am the author of `micro_timer`.
I built it at the time because I couldn't find a crate that was simple to use
and flexible to do function timing with. Turns out I just couldn't find it
because crates.io's search isn't all that great, or maybe I didn't look hard
enough.
`logging_timer` is better in every way:
- supports changing the logging level
- supports start and end logging
- supports intermediary messages
- supports inline macros
- supports formatting the output
- better IDE/tree-sitter integration thanks to a more robust proc macro
I also changed all uses to one-liners, so it's easier to copy-paste.
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 12 Jan 2023 16:15:51 +0000] rev 49985
pathauditor: make _checkfs_exists a static method
This fixes the bug detected by pytype where the auditor
used in vfs.py may be a no-op auditor (vfs.py, line 398),
which doesn't have the _checkfs_exists method.