Debian Codegraph @

rust/rhg/README.md

raw
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 ## Rough edges: a warning (also to packagers)
11
12 `rhg` should not be packaged for distribution without a warning that it is
13 experimental and that some rough edges exist, in order of worse to less bad:
14 * A node/rev that is ambiguous with a name (tag, bookmark, topic, branch)
15 will result in the command using the node/rev instead of the name, because
16 names are not implemented yet. For example, `rhg cat -r abc` will resolve
17 the `abc` node prefix and not look for the `abc` name.
18 * some config options may be ignored entirely (this is a bug, please report)
19 * pager support is not implemented yet
20 * minor errors may be silenced
21 * some error messages or error behavior may be slightly different
22 * some warning and/or error output may do lossy encoding
23 * other "terminal behavior" may be different, like color handling, etc.
24 * rhg may be overly cautious in falling back
25 * possibly other things we haven't caught yet
26
27 With this in mind, `rhg` has been used in production successfully for years now,
28 and is reasonably well tested, so feel free to use it with these warnings
29 in mind.
30
31 ## Building
32
33 To compile `rhg`, either run `cargo build --release` from this `rust/rhg/`
34 directory, or run `make build-rhg` from the repository root.
35 The executable can then be found at `rust/target/release/rhg`.
36
37 ## Mercurial configuration
38
39 `rhg` reads Mercurial configuration from the usual sources:
40 the user’s `~/.hgrc`, a repository’s `.hg/hgrc`, command line `--config`, etc.
41 It has some specific configuration in the `[rhg]` section.
42
43 See `hg help config.rhg` for details.
44
45 ## Installation and configuration example
46
47 For example, to install `rhg` as `hg` for the current user with fallback to
48 the system-wide install of Mercurial, and allow it to run even though the
49 `rebase` and `absorb` extensions are enabled, on a Unix-like platform:
50
51 * Build `rhg` (see above)
52 * Make sure the `~/.local/bin` exists and is in `$PATH`
53 * From the repository root, make a symbolic link with
54 `ln -s rust/target/release/rhg ~/.local/bin/hg`
55 * Configure `~/.hgrc` with:
56
57 ```
58 [rhg]
59 on-unsupported = fallback
60 fallback-executable = /usr/bin/hg
61 allowed-extensions = rebase, absorb
62 ```
63
64 * Check that the output of running
65 `hg notarealsubcommand`
66 starts with `hg: unknown command`, which indicates fallback.
67
68 * Check that the output of running
69 `hg notarealsubcommand --config rhg.on-unsupported=abort`
70 starts with `unsupported feature:`.