rust/README.rst
author Kyle Lippincott <spectral@google.com>
Thu, 20 Feb 2020 15:15:23 -0800
changeset 44402 6392bd7c26a8
parent 44115 e1b8b4e4f496
child 44559 47f8c741df0f
permissions -rw-r--r--
darwin: add another preemptive gui() call when using chg Changeset a89381e04c58 added this gui() call before background forks, and Google's extensions do background forks on essentially every invocation for logging purposes. The crash is reliably (though not 100%) reproducible without this change when running `HGPLAIN=1 chg status` in one of our repos. With this fix, I haven't been able to trigger the crash anymore. Differential Revision: https://phab.mercurial-scm.org/D8141
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
===================
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
Mercurial Rust Code
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
===================
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
This directory contains various Rust code for the Mercurial project.
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
     6
Rust is not required to use (or build) Mercurial, but using it
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
     7
improves performance in some areas.
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
     9
There are currently three independent rust projects:
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    10
- chg. An implementation of chg, in rust instead of C.
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    11
- hgcli. A experiment for starting hg in rust rather than in python,
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    12
  by linking with the python runtime. Probably meant to be replaced by
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    13
  PyOxidizer at some point.
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    14
- hg-core (and hg-cpython/hg-directffi): implementation of some
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    15
  functionality of mercurial in rust, e.g. ancestry computations in
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    16
  revision graphs or pull discovery. The top-level ``Cargo.toml`` file
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    17
  defines a workspace containing these crates.
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    18
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    19
Using hg-core
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    20
=============
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    22
Local use (you need to clean previous build artifacts if you have
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    23
built without rust previously)::
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    25
  $ HGWITHRUSTEXT=cpython make local # to use ./hg
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    26
  $ HGWITHRUSTEXT=cpython make tests # to run all tests
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    27
  $ (cd tests; HGWITHRUSTEXT=cpython ./run-tests.py) # only the .t
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    28
  $ ./hg debuginstall | grep rust # to validate rust is in use
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    29
  checking module policy (rust+c-allow)
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    31
Setting ``HGWITHRUSTEXT`` to other values like ``true`` is deprecated
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    32
and enables only a fraction of the rust code.
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    34
Developing hg-core
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    35
==================
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    36
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    37
Simply run::
35569
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
964212780daf rust: implementation of `hg`
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
   $ cargo build --release
44115
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    40
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    41
It is possible to build without ``--release``, but it is not
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    42
recommended if performance is of any interest: there can be an order
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    43
of magnitude of degradation when removing ``--release``.
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    44
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    45
For faster builds, you may want to skip code generation::
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    46
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    47
  $ cargo check
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    48
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    49
You can run only the rust-specific tests (as opposed to tests of
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    50
mercurial as a whole) with::
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    51
e1b8b4e4f496 rust: add a README
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 44114
diff changeset
    52
  $ cargo test --all