mercurial/helptext/rust.txt
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 26 Apr 2024 19:10:35 +0100
changeset 51626 865efc020c33
parent 50387 b88e9c707c95
permissions -rw-r--r--
dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     1
Mercurial can be augmented with Rust extensions for speeding up certain
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     2
operations.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     3
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     4
Compatibility
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     5
=============
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     6
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     7
Though the Rust extensions are only tested by the project under Linux, users of
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     8
MacOS, FreeBSD and other UNIX-likes have been using the Rust extensions. Your
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
     9
mileage may vary, but by all means do give us feedback or signal your interest
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    10
for better support.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    11
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    12
No Rust extensions are available for Windows at this time.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    13
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    14
Features
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    15
========
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    16
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    17
The following operations are sped up when using Rust:
48582
2b271cab2d1c helptext: add missing newline to Rust helptext
Raphaël Gomès <rgomes@octobus.net>
parents: 48532
diff changeset
    18
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    19
    - discovery of differences between repositories (pull/push)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    20
    - nodemap (see :hg:`help config.format.use-persistent-nodemap`)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    21
    - all commands using the dirstate (status, commit, diff, add, update, etc.)
48674
f7086f6173f8 dirstate-v2: rename the configuration to enable the format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48582
diff changeset
    22
    - dirstate-v2 (see :hg:`help config.format.use-dirstate-v2`)
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    23
    - iteration over ancestors in a graph
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    24
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    25
More features are in the works, and improvements on the above listed are still
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    26
in progress. For more experimental work see the "rhg" section.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    27
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    28
Checking for Rust
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    29
=================
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    30
49159
363b687bb794 docs: use proper rst markup for preformatted blocks
Mads Kiilerich <mads@kiilerich.com>
parents: 48674
diff changeset
    31
You may already have the Rust extensions depending on how you install
363b687bb794 docs: use proper rst markup for preformatted blocks
Mads Kiilerich <mads@kiilerich.com>
parents: 48674
diff changeset
    32
Mercurial::
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    33
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    34
  $ hg debuginstall | grep -i rust
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    35
  checking Rust extensions (installed)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    36
  checking module policy (rust+c-allow)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    37
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    38
If those lines don't even exist, you're using an old version of `hg` which does
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    39
not have any Rust extensions yet.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    40
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    41
Installing
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    42
==========
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    43
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    44
You will need `cargo` to be in your `$PATH`. See the "MSRV" section for which
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    45
version to use.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    46
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    47
Using pip
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    48
---------
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    49
49159
363b687bb794 docs: use proper rst markup for preformatted blocks
Mads Kiilerich <mads@kiilerich.com>
parents: 48674
diff changeset
    50
Users of `pip` can install the Rust extensions with the following command::
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    51
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    52
  $ pip install mercurial --global-option --rust --no-use-pep517
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    53
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    54
`--no-use-pep517` is here to tell `pip` to preserve backwards compatibility with
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    55
the legacy `setup.py` system. Mercurial has not yet migrated its complex setup
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    56
to the new system, so we still need this to add compiled extensions.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    57
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    58
This might take a couple of minutes because you're compiling everything.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    59
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    60
See the "Checking for Rust" section to see if the install succeeded.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    61
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    62
From your distribution
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    63
----------------------
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    64
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    65
Some distributions are shipping Mercurial with Rust extensions enabled and
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    66
pre-compiled (meaning you won't have to install `cargo`), or allow you to
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    67
specify an install flag. Check with your specific distribution for how to do
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    68
that, or ask their team to add support for hg+Rust!
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    69
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    70
From source
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    71
-----------
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    72
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    73
Please refer to the `rust/README.rst` file in the Mercurial repository for
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    74
instructions on how to install from source.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    75
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    76
MSRV
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    77
====
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    78
50387
b88e9c707c95 rust: configure MSRV in Clippy
Georges Racinet <georges.racinet@octobus.net>
parents: 49628
diff changeset
    79
The minimum supported Rust version is defined in `rust/clippy.toml`.
b88e9c707c95 rust: configure MSRV in Clippy
Georges Racinet <georges.racinet@octobus.net>
parents: 49628
diff changeset
    80
The project's policy is to keep it at or below the version from Debian testing,
b88e9c707c95 rust: configure MSRV in Clippy
Georges Racinet <georges.racinet@octobus.net>
parents: 49628
diff changeset
    81
to make the distributions' job easier.
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    82
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    83
rhg
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    84
===
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    85
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    86
There exists an experimental pure-Rust version of Mercurial called `rhg` with a
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    87
fallback mechanism for unsupported invocations. It allows for much faster
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    88
execution of certain commands while adding no discernable overhead for the rest.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    89
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    90
The only way of trying it out is by building it from source. Please refer to
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    91
`rust/README.rst` in the Mercurial repository.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    92
49566
b1c20e41098f rhg: add `config.rhg` helptext
Raphaël Gomès <rgomes@octobus.net>
parents: 49159
diff changeset
    93
See `hg help config.rhg` for configuration options.
b1c20e41098f rhg: add `config.rhg` helptext
Raphaël Gomès <rgomes@octobus.net>
parents: 49159
diff changeset
    94
48532
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    95
Contributing
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    96
============
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    97
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    98
If you would like to help the Rust endeavor, please refer to `rust/README.rst`
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    99
in the Mercurial repository.