Mercurial > hg
annotate rust/hgcli/README.md @ 48793:6e559391f96e
tracked-key: remove the dual write and rename to tracked-hint
The dual-write approach was mostly useless. As explained in the previous version
of the help, the key had to be read twice before we could cache a value.
However this "read twice" limitation actually also apply to any usage of the
key. If some operation wants to rely of the "same value == same tracked set"
property it would need to read the value before, and after running that
operation (or at least, after, in all cases). So it cannot be sure the operation
it did is "valid" until checking the key after the operation. As a resultat such
operation can only be read-only or rollbackable.
This reduce the utility of the "same value == same tracked set" a lot.
So it seems simpler to drop the double write and to update the documentation to
highlight that this file does not garantee race-free operation. As a result the
"key" is demoted to a "hint".
Documentation is updated accordingly.
Differential Revision: https://phab.mercurial-scm.org/D12201
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 17 Feb 2022 07:34:49 +0100 |
parents | 16c3fe46929a |
children | 45ba8416afc4 |
rev | line source |
---|---|
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # Oxidized Mercurial |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 This project provides a Rust implementation of the Mercurial (`hg`) |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 version control tool. |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 Under the hood, the project uses |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 [PyOxidizer](https://github.com/indygreg/PyOxidizer) to embed a Python |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 interpreter in a binary built with Rust. At run-time, the Rust `fn main()` |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 is called and Rust code handles initial process startup. An in-process |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 Python interpreter is started (if needed) to provide additional |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 functionality. |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 # Building |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
15 First, acquire and build a copy of PyOxidizer; you probably want to do this in |
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
16 some directory outside of your clone of Mercurial: |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 $ git clone https://github.com/indygreg/PyOxidizer.git |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 $ cd PyOxidizer |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 $ cargo build --release |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
22 Then build this Rust project using the built `pyoxidizer` executable: |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
24 $ /path/to/pyoxidizer/target/release/pyoxidizer build --release |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 If all goes according to plan, there should be an assembled application |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
27 under `build/<arch>/release/app/` with an `hg` executable: |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
29 $ build/x86_64-unknown-linux-gnu/release/app/hg version |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 Mercurial Distributed SCM (version 5.3.1+433-f99cd77d53dc+20200331) |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 (see https://mercurial-scm.org for more information) |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
46819
d4ba4d51f85f
contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents:
44639
diff
changeset
|
33 Copyright (C) 2005-2020 Olivia Mackall and others |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 This is free software; see the source for copying conditions. There is NO |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 # Running Tests |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 To run tests with a built `hg` executable, you can use the `--with-hg` |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 argument to `run-tests.py`. But there's a wrinkle: many tests run custom |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 Python scripts that need to `import` modules provided by Mercurial. Since |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 these modules are embedded in the produced `hg` executable, a regular |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 Python interpreter can't access them! To work around this, set `PYTHONPATH` |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 to the Mercurial source directory. e.g.: |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 $ cd /path/to/hg/src/tests |
48268
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
47 $ PYTHONPATH=`pwd`/.. python3.9 run-tests.py \ |
16c3fe46929a
pyoxidizer: update README.md with several small fixes
Kyle Lippincott <spectral@google.com>
parents:
46819
diff
changeset
|
48 --with-hg `pwd`/../rust/hgcli/build/x86_64-unknown-linux-gnu/release/app/hg |