Mon, 09 Jan 2023 17:48:54 +0100 rust-narrow: fix loop that never loops stable
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 17:48:54 +0100] rev 49966
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.
Tue, 13 Dec 2022 12:50:52 +0100 dirstate: enforce holding the lock while doing any changes
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 12:50:52 +0100] rev 49965
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.
Fri, 27 Jan 2023 00:45:07 +0100 largefile: make sure we hold the lock when updating the second dirstate
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Jan 2023 00:45:07 +0100] rev 49964
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.
Thu, 26 Jan 2023 15:19:39 +0100 dirstate: rename `@requires_no_parents_change` too
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:19:39 +0100] rev 49963
dirstate: rename `@requires_no_parents_change` too This match the rename of the context manager.
Thu, 26 Jan 2023 15:17:29 +0100 dirstate: rename `@requires_parents_change` to `@requires_changing_parents`
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:17:29 +0100] rev 49962
dirstate: rename `@requires_parents_change` to `@requires_changing_parents` This match the rename of the context manager.
Tue, 13 Dec 2022 12:10:37 +0100 dirstate: write dirstate on successful exit of changing_parents context
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 12:10:37 +0100] rev 49961
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.
Wed, 25 Jan 2023 19:12:31 +0100 dirstate: rename parentchange to changing_parents
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 19:12:31 +0100] rev 49960
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.
Wed, 25 Jan 2023 18:46:20 +0100 dirstate: pass the repo to the `changeparent` method
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 18:46:20 +0100] rev 49959
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.
Tue, 13 Dec 2022 10:00:04 +0100 dirstate: warn about non-explicitly rolledback parent-change
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 10:00:04 +0100] rev 49958
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.
Tue, 13 Dec 2022 11:39:44 +0100 dirstate: invalidate changes when parent-change fails
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 11:39:44 +0100] rev 49957
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.
Sat, 28 Jan 2023 20:08:57 +0100 setup: Ensure target directory exists with building rust extension
Cédric Krier <ced@b2ck.com> [Sat, 28 Jan 2023 20:08:57 +0100] rev 49956
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.
Thu, 26 Jan 2023 00:23:07 +0100 filemerge: add union-other-first as internal merge tool
Cédric Krier <ced@b2ck.com> [Thu, 26 Jan 2023 00:23:07 +0100] rev 49955
filemerge: add union-other-first as internal merge tool See inline documentation for details.
Fri, 13 Jan 2023 00:07:07 +0100 rust: use `peek_mut` from the standard lib now that it's stable
Raphaël Gomès <rgomes@octobus.net> [Fri, 13 Jan 2023 00:07:07 +0100] rev 49954
rust: use `peek_mut` from the standard lib now that it's stable Just a little cleanup of a TODO found along the way.
Wed, 25 Jan 2023 18:45:38 +0100 clippy: actually fail if there are any warnings
Raphaël Gomès <rgomes@octobus.net> [Wed, 25 Jan 2023 18:45:38 +0100] rev 49953
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.
Wed, 25 Jan 2023 18:44:09 +0100 rust-clippy: fix warning about nested ifs
Raphaël Gomès <rgomes@octobus.net> [Wed, 25 Jan 2023 18:44:09 +0100] rev 49952
rust-clippy: fix warning about nested ifs
Wed, 25 Jan 2023 19:37:06 +0400 hghave: refactor checks for pygments versions using checkvers() stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 25 Jan 2023 19:37:06 +0400] rev 49951
hghave: refactor checks for pygments versions using checkvers()
Wed, 25 Jan 2023 19:27:50 +0400 hghave: make different has_pyoxidizer functions have different names stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 25 Jan 2023 19:27:50 +0400] rev 49950
hghave: make different has_pyoxidizer functions have different names There are 3 of them, and them all having the same name triggered code checkers.
Wed, 25 Jan 2023 19:25:42 +0400 tests: pygments 2.14+ highlight whitespace in python code stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 25 Jan 2023 19:25:42 +0400] rev 49949
tests: pygments 2.14+ highlight whitespace in python code
Wed, 25 Jan 2023 18:54:17 +0400 tests: make sure pygments can detect python script without extension stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 25 Jan 2023 18:54:17 +0400] rev 49948
tests: make sure pygments can detect python script without extension This .t file was failing for me when running run-tests.py with python3.11. Then I tried to run it with python3.10 and it failed anyway, even though it's the default python3 interpreter. But with `python3 ./run-tests.py` it worked fine. And this is what I found while looking at the way pygments lexer checks if a file without extension is likely to be a python script: shebang_matches(text, r'pythonw?(3(\.\d)?)?') Take guess why it doesn't work for python >= 3.10. To work around this issue, we can simply hardcode an "easier" shebang for pygments. This path to python interpreter obviously doesn't need to be accurate, since we're not running this script.
Wed, 25 Jan 2023 17:52:00 +0400 convert: brz 3.3.0 moved NoSuchFile exception to breezy.transport stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 25 Jan 2023 17:52:00 +0400] rev 49947
convert: brz 3.3.0 moved NoSuchFile exception to breezy.transport
Tue, 06 Dec 2022 15:11:51 +0100 revset: the `random` sort should not depend on sys.maxsize (issue6770) stable
Julien Cristau <jcristau@mozilla.com> [Tue, 06 Dec 2022 15:11:51 +0100] rev 49946
revset: the `random` sort should not depend on sys.maxsize (issue6770)
Mon, 23 Jan 2023 14:04:17 +0100 contrib: adjust heptapod CI flavor sizes stable
Raphaël Gomès <rgomes@octobus.net> [Mon, 23 Jan 2023 14:04:17 +0100] rev 49945
contrib: adjust heptapod CI flavor sizes Our CI currently runs on a number of different runners, some of which are run by Clever Cloud. By setting this environement variable, we're asking for a smaller size runner for our smaller jobs, which puts less load on the Clever Cloud infrastructure, while not affecting our overall pipeline times.
Thu, 19 Jan 2023 11:12:20 -0500 debugshell: allow commands to be specified as a CLI argument
Arun Kulshreshtha <akulshreshtha@janestreet.com> [Thu, 19 Jan 2023 11:12:20 -0500] rev 49944
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.
Thu, 12 Jan 2023 19:56:59 +0400 resourceutil: start using importlib.resources.files() when possible stable
Anton Shestakov <av6@dwimlabs.net> [Thu, 12 Jan 2023 19:56:59 +0400] rev 49943
resourceutil: start using importlib.resources.files() when possible This avoids DeprecationWarnings related to our use of resources.open_binary() on Python 3.11.
Tue, 10 Jan 2023 11:40:19 +0100 heptapod-ci: add `clippy` to the CI
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:40:19 +0100] rev 49942
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`.
Tue, 10 Jan 2023 11:39:53 +0100 makefile: add `cargo clippy` to tests if cargo is available
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:39:53 +0100] rev 49941
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`.
Tue, 10 Jan 2023 11:25:24 +0100 rust-tests: run `cargo` tests inside the `rust` folder
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:25:24 +0100] rev 49940
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.
Tue, 10 Jan 2023 17:35:53 +0400 tests: fix a typo in test-demandimport.t stable
Anton Shestakov <av6@dwimlabs.net> [Tue, 10 Jan 2023 17:35:53 +0400] rev 49939
tests: fix a typo in test-demandimport.t I guess we figured out why it wasn't lazy.
Tue, 10 Jan 2023 17:23:13 +0400 tests: os module is frozen in Python 3.11 (issue6786) stable
Anton Shestakov <av6@dwimlabs.net> [Tue, 10 Jan 2023 17:23:13 +0400] rev 49938
tests: os module is frozen in Python 3.11 (issue6786)
Tue, 10 Jan 2023 11:20:54 +0100 rust-clippy: merge "revlog" module definition and struct implementation
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 11:20:54 +0100] rev 49937
rust-clippy: merge "revlog" module definition and struct implementation Module inception is confusing when looking for code and almost never the right choice.
Tue, 10 Jan 2023 10:57:15 +0100 rust-clippy: merge "config" module definition and struct implementation
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:57:15 +0100] rev 49936
rust-clippy: merge "config" module definition and struct implementation Module inception is confusing when looking for code and almost never the right choice.
Tue, 10 Jan 2023 10:45:38 +0100 rust-clippy: upgrade `bytes-cast` dependency
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:45:38 +0100] rev 49935
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.
Tue, 10 Jan 2023 10:41:52 +0100 rust-clippy: remove redundant suffix from enum
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Jan 2023 10:41:52 +0100] rev 49934
rust-clippy: remove redundant suffix from enum Same as last time, this makes the code clearer in this instance.
Mon, 09 Jan 2023 19:37:05 +0100 rust-clippy: fix remaining warnings in `hg-cpython`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:37:05 +0100] rev 49933
rust-clippy: fix remaining warnings in `hg-cpython`
Mon, 09 Jan 2023 19:36:41 +0100 rust-clippy: disable some lints crate-wide for `hg-cpython`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:36:41 +0100] rev 49932
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.
Mon, 09 Jan 2023 19:32:35 +0100 rust-clippy: fix remaining warnings in `rhg`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:32:35 +0100] rev 49931
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.
Mon, 09 Jan 2023 19:18:43 +0100 rust-clippy: fix most warnings in `hg-core`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:18:43 +0100] rev 49930
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.
Mon, 09 Jan 2023 19:14:14 +0100 rust-utils: strip redundant prefix from enum
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:14:14 +0100] rev 49929
rust-utils: strip redundant prefix from enum This was highlighted by `clippy`, I think this makes the code cleaner.
Mon, 09 Jan 2023 19:07:44 +0100 rust-filepatterns: don't `Box` subincludes unnecessarily
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 19:07:44 +0100] rev 49928
rust-filepatterns: don't `Box` subincludes unnecessarily This was caught by `clippy`.
Mon, 09 Jan 2023 18:58:18 +0100 rust-nodemap: implement `PartialEq` without allocation
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:58:18 +0100] rev 49927
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.
Mon, 09 Jan 2023 18:54:57 +0100 rust-clippy: tell `clippy` we don't need to declare a default here
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:54:57 +0100] rev 49926
rust-clippy: tell `clippy` we don't need to declare a default here This is a struct only useful for tests.
Mon, 09 Jan 2023 18:50:29 +0100 rust-clippy: refactor complex type
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:50:29 +0100] rev 49925
rust-clippy: refactor complex type This makes reading the signature a bit less tiring.
Mon, 09 Jan 2023 18:30:42 +0100 rust-clippy: simplify return type of debug function
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:30:42 +0100] rev 49924
rust-clippy: simplify return type of debug function This makes the type a little bit more readable.
Mon, 09 Jan 2023 18:27:53 +0100 rust-clippy: add `is_empty` method to please the `clippy` gods
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:27:53 +0100] rev 49923
rust-clippy: add `is_empty` method to please the `clippy` gods I can see it being useful anyway.
Mon, 09 Jan 2023 18:25:24 +0100 rust: don't use a reference to a `Cow`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:25:24 +0100] rev 49922
rust: don't use a reference to a `Cow` This was caught by `clippy`.
Mon, 09 Jan 2023 18:22:46 +0100 rust-clippy: reassure `clippy` that 8 arguments is expected
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:22:46 +0100] rev 49921
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.
Mon, 09 Jan 2023 18:15:29 +0100 rust-clippy: use `write_all` since we're not expecting a partial write
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:15:29 +0100] rev 49920
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.
Mon, 09 Jan 2023 18:09:26 +0100 rust-clippy: tell clippy we want to keep those clauses separate
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:09:26 +0100] rev 49919
rust-clippy: tell clippy we want to keep those clauses separate This makes the cases more explicit, which is wanted in this specific instance.
Mon, 09 Jan 2023 18:04:29 +0100 rust-clippy: tell clippy we care about keeping those `if` clauses separate
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:04:29 +0100] rev 49918
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.
Mon, 09 Jan 2023 18:03:24 +0100 rust-clippy: factor an `if` with the same duplicated clause
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:03:24 +0100] rev 49917
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.
Mon, 09 Jan 2023 18:00:56 +0100 rust: fix broken debug assertions
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 18:00:56 +0100] rev 49916
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.
Mon, 09 Jan 2023 17:48:54 +0100 rust-narrow: fix loop that never loops
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 17:48:54 +0100] rev 49915
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.
Mon, 09 Jan 2023 17:40:03 +0100 rust: run `cargo clippy`
Raphaël Gomès <rgomes@octobus.net> [Mon, 09 Jan 2023 17:40:03 +0100] rev 49914
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.
Fri, 06 Jan 2023 18:52:04 +0100 rust: use `logging_timer` instead of `micro_timer`
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Jan 2023 18:52:04 +0100] rev 49913
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.
Thu, 12 Jan 2023 16:15:51 +0000 pathauditor: make _checkfs_exists a static method
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 12 Jan 2023 16:15:51 +0000] rev 49912
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.
Thu, 12 Jan 2023 13:14:00 +0000 merge: add mergeresult.mapaction to improve speed
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 12 Jan 2023 13:14:00 +0000] rev 49911
merge: add mergeresult.mapaction to improve speed As a part of [hg update] we convert all [ACTION_CREATED] merge results into [ACTION_GET] actions, and that's slightly inefficient because every insertion pays the full cost of maintaining the [mergeresult] data structure up to date. This commit adds a function [mapaction], which is faster. (saves around 0.3s on a large update involving ~400k files)
Wed, 04 Jan 2023 19:30:47 +0000 merge: avoid dereferencing repo fields repeatedly
Arseniy Alekseyev <aalekseyev@janestreet.com> [Wed, 04 Jan 2023 19:30:47 +0000] rev 49910
merge: avoid dereferencing repo fields repeatedly
Fri, 06 Jan 2023 18:09:19 +0000 merge: skip syntactic path checks in [_checkunknownfile]
Arseniy Alekseyev <aalekseyev@janestreet.com> [Fri, 06 Jan 2023 18:09:19 +0000] rev 49909
merge: skip syntactic path checks in [_checkunknownfile] We don't need to check the paths syntactically, since they are coming from diffing the revisions, so hopefully already checked on the way in. We still need to check what's on the filesystem, to avoid traversing the symlinks or subdirs, which we can't know about statically. Also, we use the directory audit to elide [isfileorlink], this removing ~all lstat calls from hg updates from-empty.
Fri, 06 Jan 2023 16:42:24 +0000 pathutil: use `finddirs_rev_noroot` instead of `parts`
Arseniy Alekseyev <aalekseyev@janestreet.com> [Fri, 06 Jan 2023 16:42:24 +0000] rev 49908
pathutil: use `finddirs_rev_noroot` instead of `parts` The benefit this brings is very tiny, if it's even there, since we still didn't get rid of the [parts] computation. It probably won't be worth it without the subsequent patch that adds one more use of [finddirs_rev_noroot]
Fri, 06 Jan 2023 17:29:42 +0000 pathutil: add the more efficient finddir iterator
Arseniy Alekseyev <aalekseyev@janestreet.com> [Fri, 06 Jan 2023 17:29:42 +0000] rev 49907
pathutil: add the more efficient finddir iterator (to be used in subsequent commits)
(0) -30000 -10000 -3000 -1000 -300 -100 -60 +60 +100 +300 +1000 tip