mercurial/helptext/rust.txt
author Raphaël Gomès <rgomes@octobus.net>
Mon, 28 Feb 2022 18:34:23 +0100
branchstable
changeset 48805 d4486810a179
parent 48674 f7086f6173f8
child 49159 363b687bb794
permissions -rw-r--r--
merge: remove direct rustmod reference We shouldn't rely on this member being present in `dirstate.py`, this creates unnecessary coupling. This also can trigger certain issues in edge-cases where the policy is changed at runtime or multiple Python environments fight, which is an added bonus. Differential Revision: https://phab.mercurial-scm.org/D12217
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
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    31
You may already have the Rust extensions depending on how you install Mercurial.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    32
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    33
  $ hg debuginstall | grep -i rust
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    34
  checking Rust extensions (installed)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    35
  checking module policy (rust+c-allow)
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    36
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    37
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
    38
not have any Rust extensions yet.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    39
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    40
Installing
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    41
==========
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
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
    44
version to use.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    45
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    46
Using pip
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    47
---------
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
Users of `pip` can install the Rust extensions with the following command:
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    50
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    51
  $ 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
    52
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    53
`--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
    54
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
    55
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
    56
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    57
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
    58
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    59
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
    60
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    61
From your distribution
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    62
----------------------
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
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
    65
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
    66
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
    67
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
    68
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    69
From source
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    70
-----------
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
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
    73
instructions on how to install from source.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    74
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    75
MSRV
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    76
====
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
The minimum supported Rust version is currently 1.48.0. The project's policy is
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    79
to follow the version from Debian stable, to make the distributions' job easier.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    80
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    81
rhg
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
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    84
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
    85
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
    86
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
    87
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    88
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
    89
`rust/README.rst` in the Mercurial repository.
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    90
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    91
Contributing
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    92
============
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    93
7ccd31fda132 docs: add documentation about Rust
Raphaël Gomès <rgomes@octobus.net>
parents:
diff changeset
    94
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
    95
in the Mercurial repository.