##// END OF EJS Templates
rust: update the mention of hgcli in rust/README.rst...
Valentin Gatien-Baron -
r45439:69d3ce00 default
parent child Browse files
Show More
@@ -1,84 +1,84 b''
1 ===================
1 ===================
2 Mercurial Rust Code
2 Mercurial Rust Code
3 ===================
3 ===================
4
4
5 This directory contains various Rust code for the Mercurial project.
5 This directory contains various Rust code for the Mercurial project.
6 Rust is not required to use (or build) Mercurial, but using it
6 Rust is not required to use (or build) Mercurial, but using it
7 improves performance in some areas.
7 improves performance in some areas.
8
8
9 There are currently three independent rust projects:
9 There are currently three independent rust projects:
10 - chg. An implementation of chg, in rust instead of C.
10 - chg. An implementation of chg, in rust instead of C.
11 - hgcli. A experiment for starting hg in rust rather than in python,
11 - hgcli. A project that provide a (mostly) self-contained "hg" binary,
12 by linking with the python runtime. Probably meant to be replaced by
12 for ease of deployment and a bit of speed, using PyOxidizer. See
13 PyOxidizer at some point.
13 hgcli/README.md.
14 - hg-core (and hg-cpython): implementation of some
14 - hg-core (and hg-cpython): implementation of some
15 functionality of mercurial in rust, e.g. ancestry computations in
15 functionality of mercurial in rust, e.g. ancestry computations in
16 revision graphs, status or pull discovery. The top-level ``Cargo.toml`` file
16 revision graphs, status or pull discovery. The top-level ``Cargo.toml`` file
17 defines a workspace containing these crates.
17 defines a workspace containing these crates.
18
18
19 Using Rust code
19 Using Rust code
20 ===============
20 ===============
21
21
22 Local use (you need to clean previous build artifacts if you have
22 Local use (you need to clean previous build artifacts if you have
23 built without rust previously)::
23 built without rust previously)::
24
24
25 $ make PURE=--rust local # to use ./hg
25 $ make PURE=--rust local # to use ./hg
26 $ ./tests/run-tests.py --rust # to run all tests
26 $ ./tests/run-tests.py --rust # to run all tests
27 $ ./hg debuginstall | grep -i rust # to validate rust is in use
27 $ ./hg debuginstall | grep -i rust # to validate rust is in use
28 checking Rust extensions (installed)
28 checking Rust extensions (installed)
29 checking module policy (rust+c-allow)
29 checking module policy (rust+c-allow)
30
30
31 If the environment variable ``HGWITHRUSTEXT=cpython`` is set, the Rust
31 If the environment variable ``HGWITHRUSTEXT=cpython`` is set, the Rust
32 extension will be used by default unless ``--no-rust``.
32 extension will be used by default unless ``--no-rust``.
33
33
34 One day we may use this environment variable to switch to new experimental
34 One day we may use this environment variable to switch to new experimental
35 binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``.
35 binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``.
36
36
37 Developing Rust
37 Developing Rust
38 ===============
38 ===============
39
39
40 The current version of Rust in use is ``1.34.2``, because it's what Debian
40 The current version of Rust in use is ``1.34.2``, because it's what Debian
41 stable has. You can use ``rustup override set 1.34.2`` at the root of the repo
41 stable has. You can use ``rustup override set 1.34.2`` at the root of the repo
42 to make it easier on you.
42 to make it easier on you.
43
43
44 Go to the ``hg-cpython`` folder::
44 Go to the ``hg-cpython`` folder::
45
45
46 $ cd rust/hg-cpython
46 $ cd rust/hg-cpython
47
47
48 Or, only the ``hg-core`` folder. Be careful not to break compatibility::
48 Or, only the ``hg-core`` folder. Be careful not to break compatibility::
49
49
50 $ cd rust/hg-core
50 $ cd rust/hg-core
51
51
52 Simply run::
52 Simply run::
53
53
54 $ cargo build --release
54 $ cargo build --release
55
55
56 It is possible to build without ``--release``, but it is not
56 It is possible to build without ``--release``, but it is not
57 recommended if performance is of any interest: there can be an order
57 recommended if performance is of any interest: there can be an order
58 of magnitude of degradation when removing ``--release``.
58 of magnitude of degradation when removing ``--release``.
59
59
60 For faster builds, you may want to skip code generation::
60 For faster builds, you may want to skip code generation::
61
61
62 $ cargo check
62 $ cargo check
63
63
64 For even faster typing::
64 For even faster typing::
65
65
66 $ cargo c
66 $ cargo c
67
67
68 You can run only the rust-specific tests (as opposed to tests of
68 You can run only the rust-specific tests (as opposed to tests of
69 mercurial as a whole) with::
69 mercurial as a whole) with::
70
70
71 $ cargo test --all
71 $ cargo test --all
72
72
73 Formatting the code
73 Formatting the code
74 -------------------
74 -------------------
75
75
76 We use ``rustfmt`` to keep the code formatted at all times. For now, we are
76 We use ``rustfmt`` to keep the code formatted at all times. For now, we are
77 using the nightly version because it has been stable enough and provides
77 using the nightly version because it has been stable enough and provides
78 comment folding.
78 comment folding.
79
79
80 To format the entire Rust workspace::
80 To format the entire Rust workspace::
81
81
82 $ cargo +nightly fmt
82 $ cargo +nightly fmt
83
83
84 This requires you to have the nightly toolchain installed.
84 This requires you to have the nightly toolchain installed.
General Comments 0
You need to be logged in to leave comments. Login now