rust/rhg/README.md
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 13 Mar 2024 12:02:06 +0100
changeset 51624 b0aaffcb6fcf
parent 49556 b1c20e41098f
permissions -rw-r--r--
tags-cache: directly perform a monimal walk for hgtagsfnodescache warming We do something narrower than the path retrieving data. So lets use dedicated code instead. This provides further useful speedup: ### data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog # benchmark.name = hg.debug.debug-update-cache # bin-env-vars.hg.flavor = default # bin-env-vars.hg.py-re2-module = default # benchmark.variants.pre-state = warm before-this-series: 19.947581 skip-fnode-filter: 18.916804 (-5.17%, -1.03) use-rev-num: 17.493725 (-12.30%, -2.45) this-changesets: 15.919466 (-20.19%, -4.03)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47778
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     1
# `rhg`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     2
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     3
The `rhg` executable implements a subset of the functionnality of `hg`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     4
using only Rust, to avoid the startup cost of a Python interpreter.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     5
This subset is initially small but grows over time as `rhg` is improved.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     6
When fallback to the Python implementation is configured (see below),
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     7
`rhg` aims to be a drop-in replacement for `hg` that should behave the same,
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     8
except that some commands run faster.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
     9
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    10
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    11
## Building
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    12
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    13
To compile `rhg`, either run `cargo build --release` from this `rust/rhg/`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    14
directory, or run `make build-rhg` from the repository root.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    15
The executable can then be found at `rust/target/release/rhg`.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    16
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    17
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    18
## Mercurial configuration
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    19
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    20
`rhg` reads Mercurial configuration from the usual sources:
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    21
the user’s `~/.hgrc`, a repository’s `.hg/hgrc`, command line `--config`, etc.
49556
b1c20e41098f rhg: add `config.rhg` helptext
Raphaël Gomès <rgomes@octobus.net>
parents: 47778
diff changeset
    22
It has some specific configuration in the `[rhg]` section.
47778
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    23
49556
b1c20e41098f rhg: add `config.rhg` helptext
Raphaël Gomès <rgomes@octobus.net>
parents: 47778
diff changeset
    24
See `hg help config.rhg` for details.
47778
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    25
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    26
## Installation and configuration example
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    27
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    28
For example, to install `rhg` as `hg` for the current user with fallback to
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    29
the system-wide install of Mercurial, and allow it to run even though the
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    30
`rebase` and `absorb` extensions are enabled, on a Unix-like platform:
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    31
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    32
* Build `rhg` (see above)
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    33
* Make sure the `~/.local/bin` exists and is in `$PATH`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    34
* From the repository root, make a symbolic link with
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    35
  `ln -s rust/target/release/rhg ~/.local/bin/hg`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    36
* Configure `~/.hgrc` with:
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    37
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    38
```
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    39
[rhg]
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    40
on-unsupported = fallback
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    41
fallback-executable = /usr/bin/hg
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    42
allowed-extensions = rebase, absorb
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    43
```
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    44
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    45
* Check that the output of running
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    46
  `hg notarealsubcommand`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    47
  starts with `hg: unknown command`, which indicates fallback.
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    48
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    49
* Check that the output of running
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    50
  `hg notarealsubcommand --config rhg.on-unsupported=abort`
6df528ed47a9 rhg: Add build and config instructions to the README file
Simon Sapin <simon.sapin@octobus.net>
parents: 45001
diff changeset
    51
  starts with `unsupported feature:`.