##// END OF EJS Templates
rhg: Add build and config instructions to the README file...
Simon Sapin -
r48583:6df528ed stable
parent child Browse files
Show More
@@ -1,4 +1,77 b''
1 # rhg
1 # `rhg`
2
3 The `rhg` executable implements a subset of the functionnality of `hg`
4 using only Rust, to avoid the startup cost of a Python interpreter.
5 This subset is initially small but grows over time as `rhg` is improved.
6 When fallback to the Python implementation is configured (see below),
7 `rhg` aims to be a drop-in replacement for `hg` that should behave the same,
8 except that some commands run faster.
9
10
11 ## Building
12
13 To compile `rhg`, either run `cargo build --release` from this `rust/rhg/`
14 directory, or run `make build-rhg` from the repository root.
15 The executable can then be found at `rust/target/release/rhg`.
16
17
18 ## Mercurial configuration
19
20 `rhg` reads Mercurial configuration from the usual sources:
21 the user’s `~/.hgrc`, a repository’s `.hg/hgrc`, command line `--config`, etc.
22 It has some specific configuration in the `[rhg]` section:
23
24 * `on-unsupported` governs the behavior of `rhg` when it encounters something
25 that it does not support but “full” `hg` possibly does.
26 This can be in configuration, on the command line, or in a repository.
27
28 - `abort`, the default value, makes `rhg` print a message to stderr
29 to explain what is not supported, then terminate with a 252 exit code.
30 - `abort-silent` makes it terminate with the same exit code,
31 but without printing anything.
32 - `fallback` makes it silently call a (presumably Python-based) `hg`
33 subprocess with the same command-line parameters.
34 The `rhg.fallback-executable` configuration must be set.
35
36 * `fallback-executable`: path to the executable to run in a sub-process
37 when falling back to a Python implementation of Mercurial.
2
38
3 This project provides a fastpath Rust implementation of the Mercurial (`hg`)
39 * `allowed-extensions`: a list of extension names that `rhg` can ignore.
4 version control tool.
40
41 Mercurial extensions can modify the behavior of existing `hg` sub-commands,
42 including those that `rhg` otherwise supports.
43 Because it cannot load Python extensions, finding them
44 enabled in configuration is considered “unsupported” (see above).
45 A few exceptions are made for extensions that `rhg` does know about,
46 with the Rust implementation duplicating their behavior.
47
48 This configuration makes additional exceptions: `rhg` will proceed even if
49 those extensions are enabled.
50
51
52 ## Installation and configuration example
53
54 For example, to install `rhg` as `hg` for the current user with fallback to
55 the system-wide install of Mercurial, and allow it to run even though the
56 `rebase` and `absorb` extensions are enabled, on a Unix-like platform:
57
58 * Build `rhg` (see above)
59 * Make sure the `~/.local/bin` exists and is in `$PATH`
60 * From the repository root, make a symbolic link with
61 `ln -s rust/target/release/rhg ~/.local/bin/hg`
62 * Configure `~/.hgrc` with:
63
64 ```
65 [rhg]
66 on-unsupported = fallback
67 fallback-executable = /usr/bin/hg
68 allowed-extensions = rebase, absorb
69 ```
70
71 * Check that the output of running
72 `hg notarealsubcommand`
73 starts with `hg: unknown command`, which indicates fallback.
74
75 * Check that the output of running
76 `hg notarealsubcommand --config rhg.on-unsupported=abort`
77 starts with `unsupported feature:`.
General Comments 0
You need to be logged in to leave comments. Login now