rust/hgcli/README.md
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 25 Apr 2023 17:49:35 -0400
branchstable
changeset 50359 f4ff55583dec
parent 48268 16c3fe46929a
child 51668 45ba8416afc4
permissions -rw-r--r--
fix: highlight the required configuration and behavior of the fixer tools The problem is that `hg help fix` didn't mention *how* to configure the tools, and while I knew that `{rootpath}` existed in the configuration, I missed that the tools require reading content from stdin. (I configured `gofmt` to use `{rootpath}`, and that had the effect of squashing all changes in a file at `.` into the first commit and emptying that content from its descendants.) Basically all this does is put a pointer in the default (command level) help to the extension level help that mentions the configuration, and moves the extension level help that documents reading from stdin and writing to stdout to the top to give it more prominence. The last sentence is adjusted a bit to reflect the new location.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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