diff --git a/.hgsigs b/.hgsigs --- a/.hgsigs +++ b/.hgsigs @@ -220,3 +220,4 @@ 750920b18aaaddd654756be40dec59d90f2643be 6ee0244fc1cf889ae543d2ce0ec45201ae0be6e1 0 iQJJBAABCgAzFiEEgY2HzRrBgMOUyG5jOjPeRg2ew58FAmF4AWgVHDc4OTVwdWxraXRAZ21haWwuY29tAAoJEDoz3kYNnsOfxu8P/R8FftAoLkFGHnrzXA9Wa+ch+wunUNixCSimuXjG5sUtDSDlNT+xGj0deTVRVDylFd5HShR6a8NV+2P9edgJYDOKE70j4DJxHdeDyZ3l09YEBymrluE4FygXwpG0B3Ew9pUD85yFxa6UfIFWvNTGYi7XCHBl85buCkMACafN97802jXuE3JV53FvW6Fp917hM0saG48Cnp33WZxdUrZdxXU0Q8bZ9OBYCuGq8Wt2ZIqfEM6YXmvOzlkZf6oJb65rYOw2KgfLs/5nEGiDUNK2akuEhAZLi7uL0dt4WzYAbLyRhIpMpFPitk9P+Ges7iYINwSyZKZcsNPm0NiJupSjKqIYuuLte9HR59RkDFGgM9hbFnskElgHXMqLxi+RqjDVrj2efbuyWzDCn6eVZyn7vmxy9/oLM9vnVsvvdziN2uNUPL4CVmnOZciCdkEZQtWynyyEGzNyq7kPH593ct3tYMxpzs3wa3o+sSdph3lf7caXskij0d0woRZneuZFwp26Ha9tKMMRmXzgFvipzL+o2ANWV6X2udO0pXmKhzYJSBcUPlmVz8hyJaV2D3nmXeFHKVrPa/CqnSGNPWNQC39im1NyPKbfJAA9DZmw7FKg/b23tJq8w9WkBAghEUhC4e54Eb068awt/RDaD6oBYfpdCnQ1pbC/6PHnRSOm8PubGoOZ a44bb185f6bdbecc754996d8386722e2f0123b0a 0 iQJJBAABCgAzFiEEgY2HzRrBgMOUyG5jOjPeRg2ew58FAmGKo4sVHDc4OTVwdWxraXRAZ21haWwuY29tAAoJEDoz3kYNnsOffmQP/jsOxxP0F9TliKYp7YjgMagtnebk+qdbq9pX8y8GdjGirRwCy/rMm3pXMNQ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c5GZysrXw+T/YLxFKuxls1uCq6mTBxbf/aJ91G4m0UT/fczNrQaDDhPIFEZVktd18NphUOebTGxDiCW/mk9IOXxEI7bprlBdBBM3dkCAg+O0h8kdN007jjoLIiTw7K+XZ1A41zqGqXMQ2R/0xTltX9NXAe9xNhAEQhwSCH2TsB5IKI6+EHE6ZaNsyuwvlPhaQXfmOU22JBlUGE9IdEU5whd9760xJYTx3WEnbuED0UltAt3vgyvq+li1/Z7HDuzUyNha8YsaPw2QeHFUFwzxqoxo501/eDs9bXjBt7E4vsYVQC51sb3uS9kRbBB9GOiyx/HICZcbEQjy5TxVW5Bp0uD6Fu3nRytL0DDDIDF +799fdf4cca80cb9ae40537a90995e6bd163ebc0b 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmHVzPMZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVmiyC/48p6+/JJi8WaY+Xdxh1IMK1/CB3dYcC99+V89asIW+g/X/0FacTSSAGkvDrjNSeYAkXGp3g/LbEbwoZhKxF8MyKU7TOn62lz8JETwebtjxehjVfPUy73RJbuLPDvn9m16YHxuC848hDZHnqk/PjaBVHeZ2cN8T7F9VgXkhyYStV9GT2PSQUsvkQAxjiLilyKs3RaZAduZPvOmGaq2CfK91PbScKaKgYShkKym7gfhU1o4pynNmuPqRwUJyihaZqsKDjOn8OHeJpqAm7ODmR+SIOvMvFbbfS8mTSfYMHsP+r+JgbqSVNG99qEqsIW3HznGe/OpG/1QS3MVVSyi87oHR1UcN91vKIiln92i+7Ct7GttjkgkkqfQEw1oAELCmiHacYEBbLvQGaXdHROeO6wqXUKvI4KeM3CPt2qsouPiKBzSF1eOPd967NNvgTgcabT2ob0YaXmWdZasJnZ74H/3FMMC98WhYe3ja+6cpl67PZlNUWlnIZBlyL63DWSJ09us= diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -233,3 +233,4 @@ 750920b18aaaddd654756be40dec59d90f2643be 6ee0244fc1cf889ae543d2ce0ec45201ae0be6e1 5.9.3 a44bb185f6bdbecc754996d8386722e2f0123b0a 6.0rc0 5d08b289e2e526259d7d5ea32b70fe76d5b327d7 6.0 +799fdf4cca80cb9ae40537a90995e6bd163ebc0b 6.0.1 diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -484,6 +484,15 @@ helptable = sorted( TOPIC_CATEGORY_IDS, ), ( + [ + b'rust', + b'rustext', + ], + _(b'Rust in Mercurial'), + loaddoc(b'rust'), + TOPIC_CATEGORY_CONFIG, + ), + ( [b'filesets', b'fileset'], _(b"Specifying File Sets"), loaddoc(b'filesets'), diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -915,29 +915,60 @@ https://www.mercurial-scm.org/wiki/Missi Enabled by default. +``exp-rc-dirstate-v2`` + Enable or disable the experimental "dirstate-v2" feature. The dirstate + functionality is shared by all commands interacting with the working copy. + The new version is more robust, faster and stores more information. + + The performance-improving version of this feature is currently only + implemented in Rust (see :hg:`help rust`), so people not using a version of + Mercurial compiled with the Rust parts might actually suffer some slowdown. + For this reason, such versions will by default refuse to access repositories + with "dirstate-v2" enabled. + + This behavior can be adjusted via configuration: check + :hg:`help config.storage.dirstate-v2.slow-path` for details. + + Repositories with this on-disk format require Mercurial 6.0 or above. + + By default this format variant is disabled if the fast implementation is not + available, and enabled by default if the fast implementation is available. + + To accomodate installations of Mercurial without the fast implementation, + you can downgrade your repository. To do so run the following command: + + $ hg debugupgraderepo \ + --run \ + --config format.exp-rc-dirstate-v2=False \ + --config storage.dirstate-v2.slow-path=allow + + For a more comprehensive guide, see :hg:`help internals.dirstate-v2`. + ``use-persistent-nodemap`` Enable or disable the "persistent-nodemap" feature which improves - performance if the rust extensions are available. - - The "persistence-nodemap" persist the "node -> rev" on disk removing the + performance if the Rust extensions are available. + + The "persistent-nodemap" persist the "node -> rev" on disk removing the need to dynamically build that mapping for each Mercurial invocation. This - significantly reduce the startup cost of various local and server-side - operation for larger repository. - - The performance improving version of this feature is currently only - implemented in Rust, so people not using a version of Mercurial compiled - with the Rust part might actually suffer some slowdown. For this reason, - Such version will by default refuse to access such repositories. That - behavior can be controlled by configuration. Check + significantly reduces the startup cost of various local and server-side + operation for larger repositories. + + The performance-improving version of this feature is currently only + implemented in Rust (see :hg:`help rust`), so people not using a version of + Mercurial compiled with the Rust parts might actually suffer some slowdown. + For this reason, such versions will by default refuse to access repositories + with "persistent-nodemap". + + This behavior can be adjusted via configuration: check :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details. - Repository with this on-disk format require Mercurial version 5.4 or above. - - By default this format variant is disabled if fast implementation is not - available and enabled by default if the fast implementation is available. - - To accomodate install of Mercurial without the fast implementation you can - downgrade your repository. To do so run the following command: + Repositories with this on-disk format require Mercurial 5.4 or above. + + By default this format variant is disabled if the fast implementation is not + available, and enabled by default if the fast implementation is available. + + To accomodate installations of Mercurial without the fast implementation, + you can downgrade your repository. To do so run the following command: $ hg debugupgraderepo \ --run \ diff --git a/mercurial/helptext/rust.txt b/mercurial/helptext/rust.txt new file mode 100644 --- /dev/null +++ b/mercurial/helptext/rust.txt @@ -0,0 +1,94 @@ +Mercurial can be augmented with Rust extensions for speeding up certain +operations. + +Compatibility +============= + +Though the Rust extensions are only tested by the project under Linux, users of +MacOS, FreeBSD and other UNIX-likes have been using the Rust extensions. Your +mileage may vary, but by all means do give us feedback or signal your interest +for better support. + +No Rust extensions are available for Windows at this time. + +Features +======== + +The following operations are sped up when using Rust: + - discovery of differences between repositories (pull/push) + - nodemap (see :hg:`help config.format.use-persistent-nodemap`) + - all commands using the dirstate (status, commit, diff, add, update, etc.) + - dirstate-v2 (see :hg:`help config.format.exp-rc-dirstate-v2`) + - iteration over ancestors in a graph + +More features are in the works, and improvements on the above listed are still +in progress. For more experimental work see the "rhg" section. + +Checking for Rust +================= + +You may already have the Rust extensions depending on how you install Mercurial. + + $ hg debuginstall | grep -i rust + checking Rust extensions (installed) + checking module policy (rust+c-allow) + +If those lines don't even exist, you're using an old version of `hg` which does +not have any Rust extensions yet. + +Installing +========== + +You will need `cargo` to be in your `$PATH`. See the "MSRV" section for which +version to use. + +Using pip +--------- + +Users of `pip` can install the Rust extensions with the following command: + + $ pip install mercurial --global-option --rust --no-use-pep517 + +`--no-use-pep517` is here to tell `pip` to preserve backwards compatibility with +the legacy `setup.py` system. Mercurial has not yet migrated its complex setup +to the new system, so we still need this to add compiled extensions. + +This might take a couple of minutes because you're compiling everything. + +See the "Checking for Rust" section to see if the install succeeded. + +From your distribution +---------------------- + +Some distributions are shipping Mercurial with Rust extensions enabled and +pre-compiled (meaning you won't have to install `cargo`), or allow you to +specify an install flag. Check with your specific distribution for how to do +that, or ask their team to add support for hg+Rust! + +From source +----------- + +Please refer to the `rust/README.rst` file in the Mercurial repository for +instructions on how to install from source. + +MSRV +==== + +The minimum supported Rust version is currently 1.48.0. The project's policy is +to follow the version from Debian stable, to make the distributions' job easier. + +rhg +=== + +There exists an experimental pure-Rust version of Mercurial called `rhg` with a +fallback mechanism for unsupported invocations. It allows for much faster +execution of certain commands while adding no discernable overhead for the rest. + +The only way of trying it out is by building it from source. Please refer to +`rust/README.rst` in the Mercurial repository. + +Contributing +============ + +If you would like to help the Rust endeavor, please refer to `rust/README.rst` +in the Mercurial repository. diff --git a/rust/README.rst b/rust/README.rst --- a/rust/README.rst +++ b/rust/README.rst @@ -6,15 +6,18 @@ This directory contains various Rust cod Rust is not required to use (or build) Mercurial, but using it improves performance in some areas. -There are currently three independent rust projects: -- chg. An implementation of chg, in rust instead of C. -- hgcli. A project that provide a (mostly) self-contained "hg" binary, +There are currently four independent Rust projects: +- chg. An implementation of chg, in Rust instead of C. +- hgcli. A project that provides a (mostly) self-contained "hg" binary, for ease of deployment and a bit of speed, using PyOxidizer. See hgcli/README.md. - hg-core (and hg-cpython): implementation of some - functionality of mercurial in rust, e.g. ancestry computations in + functionality of mercurial in Rust, e.g. ancestry computations in revision graphs, status or pull discovery. The top-level ``Cargo.toml`` file defines a workspace containing these crates. +- rhg: a pure Rust implementation of Mercurial, with a fallback mechanism for + unsupported invocations. It reuses the logic `hg-core` but completely forgoes + interaction with Python. See `rust/rhg/README.md` for more details. Using Rust code =============== diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -414,6 +414,7 @@ Testing -h/--help: hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: @@ -548,6 +549,7 @@ Testing -h/--help: hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t --- a/tests/test-help-hide.t +++ b/tests/test-help-hide.t @@ -113,6 +113,7 @@ Test hiding some commands (which also ha hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: @@ -251,6 +252,7 @@ Test hiding some topics. hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -165,6 +165,7 @@ the extension is unknown. hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: @@ -295,6 +296,7 @@ the extension is unknown. hgweb Configuring hgweb merge-tools Merge Tools pager Pager Support + rust Rust in Mercurial Concepts: @@ -1595,6 +1597,8 @@ Separate sections from subsections "usefncache" + "exp-rc-dirstate-v2" + "use-persistent-nodemap" "use-share-safe" @@ -2425,6 +2429,13 @@ Dish up an empty repo; serve it cold. Specifying Revisions