Mercurial > hg
comparison rust/README.rst @ 44115:e1b8b4e4f496
rust: add a README
In particular to explain how to build any of the rust. It's neither
obvious, nor easy to find out, nor easy to determine if you did it
right without some documentation.
Differential Revision: https://phab.mercurial-scm.org/D7952
author | Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> |
---|---|
date | Mon, 20 Jan 2020 18:28:46 -0500 |
parents | 8a3b045d9086 |
children | 47f8c741df0f |
comparison
equal
deleted
inserted
replaced
44114:8a3b045d9086 | 44115:e1b8b4e4f496 |
---|---|
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 | |
7 improves performance in some areas. | |
6 | 8 |
7 The top-level ``Cargo.toml`` file defines a workspace containing | 9 There are currently three independent rust projects: |
8 all primary Mercurial crates. | 10 - chg. An implementation of chg, in rust instead of C. |
11 - hgcli. A experiment for starting hg in rust rather than in python, | |
12 by linking with the python runtime. Probably meant to be replaced by | |
13 PyOxidizer at some point. | |
14 - hg-core (and hg-cpython/hg-directffi): implementation of some | |
15 functionality of mercurial in rust, e.g. ancestry computations in | |
16 revision graphs or pull discovery. The top-level ``Cargo.toml`` file | |
17 defines a workspace containing these crates. | |
9 | 18 |
10 Building | 19 Using hg-core |
11 ======== | 20 ============= |
12 | 21 |
13 To build the Rust components:: | 22 Local use (you need to clean previous build artifacts if you have |
23 built without rust previously):: | |
14 | 24 |
15 $ cargo build | 25 $ HGWITHRUSTEXT=cpython make local # to use ./hg |
26 $ HGWITHRUSTEXT=cpython make tests # to run all tests | |
27 $ (cd tests; HGWITHRUSTEXT=cpython ./run-tests.py) # only the .t | |
28 $ ./hg debuginstall | grep rust # to validate rust is in use | |
29 checking module policy (rust+c-allow) | |
16 | 30 |
17 If you prefer a non-debug / release configuration:: | 31 Setting ``HGWITHRUSTEXT`` to other values like ``true`` is deprecated |
32 and enables only a fraction of the rust code. | |
33 | |
34 Developing hg-core | |
35 ================== | |
36 | |
37 Simply run:: | |
18 | 38 |
19 $ cargo build --release | 39 $ cargo build --release |
40 | |
41 It is possible to build without ``--release``, but it is not | |
42 recommended if performance is of any interest: there can be an order | |
43 of magnitude of degradation when removing ``--release``. | |
44 | |
45 For faster builds, you may want to skip code generation:: | |
46 | |
47 $ cargo check | |
48 | |
49 You can run only the rust-specific tests (as opposed to tests of | |
50 mercurial as a whole) with:: | |
51 | |
52 $ cargo test --all |