2020-12-12 07:37:25 +00:00
|
|
|
# How to Contribute
|
|
|
|
|
2022-11-28 03:05:06 +00:00
|
|
|
|
2022-11-25 04:42:30 +00:00
|
|
|
## Policies
|
|
|
|
|
2020-12-12 07:37:25 +00:00
|
|
|
We'd love to accept your patches and contributions to this project. There are
|
|
|
|
just a few small guidelines you need to follow.
|
|
|
|
|
2022-11-25 04:42:30 +00:00
|
|
|
### Contributor License Agreement
|
2020-12-12 07:37:25 +00:00
|
|
|
|
|
|
|
Contributions to this project must be accompanied by a Contributor License
|
|
|
|
Agreement. You (or your employer) retain the copyright to your contribution;
|
|
|
|
this simply gives us permission to use and redistribute your contributions as
|
|
|
|
part of the project. Head over to <https://cla.developers.google.com/> to see
|
|
|
|
your current agreements on file or to sign a new one.
|
|
|
|
|
|
|
|
You generally only need to submit a CLA once, so if you've already submitted one
|
|
|
|
(even if it was for a different project), you probably don't need to do it
|
|
|
|
again.
|
|
|
|
|
2022-11-25 04:42:30 +00:00
|
|
|
### Code reviews
|
2020-12-12 07:37:25 +00:00
|
|
|
|
|
|
|
All submissions, including submissions by project members, require review. We
|
|
|
|
use GitHub pull requests for this purpose. Consult
|
|
|
|
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
|
|
|
information on using pull requests.
|
|
|
|
|
2022-12-02 01:21:26 +00:00
|
|
|
Unlike many GitHub projects (but like many VCS projects), we care more about the
|
|
|
|
contents of commits than about the contents of PRs. We review each commit
|
2023-09-07 15:14:00 +00:00
|
|
|
separately, and we don't squash-merge the PR (so please manually squash any
|
|
|
|
fixup commits before sending for review).
|
2022-12-02 01:21:26 +00:00
|
|
|
|
|
|
|
Each commit should ideally do one thing. For example, if you need to refactor a
|
|
|
|
function in order to add a new feature cleanly, put the refactoring in one
|
|
|
|
commit and the new feature in a different commit. If the refactoring itself
|
|
|
|
consists of many parts, try to separate out those into separate commits. You can
|
|
|
|
use `jj split` to do it if you didn't realize ahead of time how it should be
|
2024-04-24 01:20:41 +00:00
|
|
|
split up. Include tests and documentation in the same commit as the code they
|
2022-12-02 01:21:26 +00:00
|
|
|
test and document. The commit message should describe the changes in the commit;
|
|
|
|
the PR description can even be empty, but feel free to include a personal
|
|
|
|
message.
|
|
|
|
|
|
|
|
When you address comments on a PR, don't make the changes in a commit on top (as
|
|
|
|
is typical on GitHub). Instead, please make the changes in the appropriate
|
2024-04-24 19:54:26 +00:00
|
|
|
commit. You can do that by creating a new commit on top of the initial commit
|
|
|
|
(`jj new <commit>`) and then squash in the changes when you're done (`jj squash`).
|
|
|
|
`jj git push`
|
2024-08-21 19:59:15 +00:00
|
|
|
will automatically force-push the bookmark.
|
2022-12-02 01:21:26 +00:00
|
|
|
|
|
|
|
When your first PR has been approved, we typically give you contributor access,
|
|
|
|
so you can address any remaining minor comments and then merge the PR yourself
|
|
|
|
when you're ready. If you realize that some comments require non-trivial
|
|
|
|
changes, please ask your reviewer to take another look.
|
|
|
|
|
2024-02-06 21:40:05 +00:00
|
|
|
To avoid conflicts of interest, please don't merge a PR that has only been
|
|
|
|
approved by someone from the same organization. Similarly, as a reviewer,
|
|
|
|
there is no need to approve your coworkers' PRs, since the author should await
|
|
|
|
an approval from someone else anyway. It is of course still appreciated if you
|
|
|
|
review and comment on their PRs. Also, if the PR seems completely unrelated to
|
|
|
|
your company's interests, do feel free to approve it.
|
2022-12-02 01:21:26 +00:00
|
|
|
|
2022-11-25 04:42:30 +00:00
|
|
|
### Community Guidelines
|
2020-12-12 07:37:25 +00:00
|
|
|
|
|
|
|
This project follows [Google's Open Source Community
|
|
|
|
Guidelines](https://opensource.google/conduct/).
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2024-06-17 20:17:16 +00:00
|
|
|
## Contributing large patches
|
|
|
|
|
|
|
|
Before sending a PR for a large change which designs/redesigns or reworks an
|
|
|
|
existing component, we require an architecture review from multiple
|
|
|
|
stakeholders, which we do with [Design Docs](design_docs.md), see the
|
|
|
|
[process here](design_docs.md#process).
|
2022-11-28 03:05:06 +00:00
|
|
|
|
2023-09-09 00:26:18 +00:00
|
|
|
## Contributing to the documentation
|
|
|
|
|
|
|
|
We appreciate [bug
|
|
|
|
reports](https://github.com/martinvonz/jj/issues/new?template=bug_report.md)
|
|
|
|
about any problems, however small, lurking in [our documentation
|
|
|
|
website](https://martinvonz.github.io/jj/prerelease) or in the `jj help
|
|
|
|
<command>` docs. If a part of the bug report template does not apply, you can
|
|
|
|
just delete it.
|
|
|
|
|
|
|
|
Before reporting a problem with the documentation website, we'd appreciate it if
|
|
|
|
you could check that the problem still exists in the "prerelease" version of the
|
|
|
|
documentation (as opposed to the docs for one of the released versions of `jj`).
|
|
|
|
You can use the version switcher in the top-left of the website to do so.
|
|
|
|
|
|
|
|
If you are willing to make a PR fixing a documentation problem, even better!
|
|
|
|
|
|
|
|
The documentation website sources are Markdown files located in the [`docs/`
|
|
|
|
directory](https://github.com/martinvonz/jj/tree/main/docs). You do not need to
|
|
|
|
know Rust to work with them. See below for [instructions on how to preview the
|
|
|
|
HTML docs](#previewing-the-html-documentation) as you edit the Markdown files.
|
|
|
|
Doing so is optional, but recommended.
|
|
|
|
|
|
|
|
The `jj help` docs are sourced from the "docstring" comments inside the Rust
|
|
|
|
sources, currently from the [`cli/src/commands`
|
|
|
|
directory](https://github.com/martinvonz/jj/tree/main/cli/src/commands). Working
|
|
|
|
on them requires setting up a Rust development environment, as described
|
|
|
|
below, and may occasionally require adjusting a test.
|
|
|
|
|
|
|
|
|
2023-01-21 21:01:41 +00:00
|
|
|
## Learning Rust
|
|
|
|
|
|
|
|
In addition to the [Rust Book](https://doc.rust-lang.org/book/) and the other
|
2023-08-13 01:38:57 +00:00
|
|
|
excellent resources at <https://www.rust-lang.org/learn>, we recommend the
|
2023-01-21 21:01:41 +00:00
|
|
|
["Comprehensive Rust" mini-course](https://google.github.io/comprehensive-rust/)
|
|
|
|
for an overview, especially if you are familiar with C++.
|
|
|
|
|
2022-11-25 04:42:30 +00:00
|
|
|
## Setting up a development environment
|
|
|
|
|
2022-12-16 06:51:58 +00:00
|
|
|
To develop `jj`, the mandatory steps are simply
|
|
|
|
to [install Rust](https://www.rust-lang.org/tools/install) (the default
|
|
|
|
installer options are fine), clone the repository, and use `cargo build`
|
|
|
|
, `cargo fmt`,
|
2023-08-18 21:03:54 +00:00
|
|
|
`cargo clippy --workspace --all-targets`, and
|
2022-12-16 06:51:58 +00:00
|
|
|
`cargo test --workspace`. If you are preparing a PR, there are some additional
|
2022-11-28 03:05:06 +00:00
|
|
|
recommended steps.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
|
|
|
### Summary
|
|
|
|
|
|
|
|
One-time setup:
|
|
|
|
|
2023-07-11 13:08:13 +00:00
|
|
|
rustup toolchain add nightly # wanted for 'rustfmt'
|
2023-10-28 19:14:26 +00:00
|
|
|
rustup toolchain add 1.76 # also specified in Cargo.toml
|
2022-11-25 04:42:30 +00:00
|
|
|
cargo install cargo-insta
|
|
|
|
cargo install cargo-watch
|
2022-12-16 06:51:58 +00:00
|
|
|
cargo install cargo-nextest
|
2022-11-25 04:42:30 +00:00
|
|
|
|
|
|
|
During development (adapt according to your preference):
|
|
|
|
|
2022-11-28 03:05:06 +00:00
|
|
|
cargo watch --ignore '.jj/**' -s \
|
2023-01-12 19:00:10 +00:00
|
|
|
'cargo clippy --workspace --all-targets \
|
2023-10-28 19:14:26 +00:00
|
|
|
&& cargo +1.76 check --workspace --all-targets'
|
2023-01-12 19:00:10 +00:00
|
|
|
cargo +nightly fmt # Occasionally
|
2022-12-16 06:51:58 +00:00
|
|
|
cargo nextest run --workspace # Occasionally
|
2023-08-18 21:03:54 +00:00
|
|
|
cargo insta test --workspace --test-runner nextest # Occasionally
|
2022-11-25 04:42:30 +00:00
|
|
|
|
|
|
|
WARNING: Build artifacts from debug builds and especially from repeated
|
|
|
|
invocations of `cargo test` can quickly take up 10s of GB of disk space.
|
|
|
|
Cargo will happily use up your entire hard drive. If this happens, run
|
|
|
|
`cargo clean`.
|
|
|
|
|
|
|
|
### Explanation
|
|
|
|
|
2022-11-28 03:05:06 +00:00
|
|
|
These are listed roughly in order of decreasing importance.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2022-12-16 06:51:58 +00:00
|
|
|
1. Nearly any change to `jj`'s CLI will require writing or updating snapshot
|
|
|
|
tests that use the [`insta`](https://insta.rs/) crate. To make this
|
|
|
|
convenient, install the `cargo-insta` binary.
|
|
|
|
Use `cargo insta test --workspace` to run tests,
|
|
|
|
and `cargo insta review --workspace` to update the snapshot tests.
|
|
|
|
The `--workspace` flag is needed to run the tests on all crates; by default,
|
|
|
|
only the crate in the current directory is tested.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2023-08-28 17:30:33 +00:00
|
|
|
2. GitHub CI checks require that the code is formatted with the *nightly*
|
2022-12-16 06:51:58 +00:00
|
|
|
version of `rustfmt`. To do this on your computer, install the nightly
|
|
|
|
toolchain and use `cargo +nightly fmt`.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2022-12-16 06:51:58 +00:00
|
|
|
3. Your code will be rejected if it cannot be compiled with the minimal
|
2023-07-11 13:08:13 +00:00
|
|
|
supported version of Rust ("MSRV"). Currently, `jj` follows a rather
|
|
|
|
casual MSRV policy: "The current `rustc` stable version, minus one."
|
2023-10-28 19:14:26 +00:00
|
|
|
As of this writing, that version is **1.76.0**.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2022-12-16 06:51:58 +00:00
|
|
|
4. Your code needs to pass `cargo clippy`. You can also
|
|
|
|
use `cargo +nightly clippy` if you wish to see more warnings.
|
2022-11-25 04:42:30 +00:00
|
|
|
|
2022-12-16 06:51:58 +00:00
|
|
|
5. You may also want to install and use `cargo-watch`. In this case, you should
|
|
|
|
exclude `.jj`. directory from the filesystem watcher, as it gets updated on
|
|
|
|
every `jj log`.
|
|
|
|
|
|
|
|
6. To run tests more quickly, use `cargo nextest run --workspace`. To
|
2024-01-13 06:28:15 +00:00
|
|
|
use `nextest` with `insta`, use `cargo insta test --workspace
|
|
|
|
--test-runner nextest`.
|
|
|
|
|
|
|
|
On Linux, you may be able to speed up `nextest` even further by using
|
|
|
|
the `mold` linker, as explained below.
|
|
|
|
|
|
|
|
### Using `mold` for faster tests on Linux
|
|
|
|
|
|
|
|
On a machine with a multi-core CPU, one way to speed up
|
|
|
|
`cargo nextest` on Linux is to use the multi-threaded [`mold`
|
|
|
|
linker](https://github.com/rui314/mold). This linker may help
|
|
|
|
if, currently, your CPU is underused while Rust is linking test
|
|
|
|
binaries. Before proceeding with `mold`, you can check whether this is
|
|
|
|
an issue worth solving using a system monitoring tool such as `htop`.
|
|
|
|
|
|
|
|
`mold` is packaged for many distributions. On Debian, for example,
|
|
|
|
`sudo apt install mold` should just work.
|
|
|
|
|
|
|
|
A simple way to use `mold` is via the `-run` option, e.g.:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
mold -run cargo insta test --workspace --test-runner nextest
|
|
|
|
```
|
|
|
|
|
|
|
|
There will be no indication that a different linker is used, except for
|
|
|
|
higher CPU usage while linking and, hopefully, faster completion. You
|
|
|
|
can verify that `mold` was indeed used by running
|
|
|
|
`readelf -p .comment target/debug/jj`.
|
|
|
|
|
|
|
|
There are also ways of having Rust use `mold` by default, see the ["How
|
|
|
|
to use" instructions](https://github.com/rui314/mold#how-to-use).
|
|
|
|
|
|
|
|
On recent versions of MacOS, the default linker Rust uses is already
|
|
|
|
multi-threaded. It should use all the CPU cores without any configuration.
|
|
|
|
|
2023-08-18 21:03:54 +00:00
|
|
|
|
2023-08-18 23:43:20 +00:00
|
|
|
## Previewing the HTML documentation
|
|
|
|
|
2023-09-09 00:26:18 +00:00
|
|
|
The documentation for `jj` is automatically published to the website at
|
|
|
|
<https://martinvonz.github.io/jj/>.
|
2023-08-26 02:52:47 +00:00
|
|
|
|
|
|
|
When editing documentation, we'd appreciate it if you checked that the
|
|
|
|
result will look as expected when published to the website.
|
2023-08-18 23:43:20 +00:00
|
|
|
|
|
|
|
### Setting up the prerequisites
|
|
|
|
|
2024-05-12 22:30:26 +00:00
|
|
|
To build the website, you must have Python and `poetry 1.8+` installed (the
|
|
|
|
latest version is recommended). It is easiest to install `poetry` via `pipx`, as
|
|
|
|
explained in the [Poetry installation instructions]. A few helpful points from
|
|
|
|
the instructions: `pipx` can often be installed from your distribution, e.g.
|
|
|
|
`sudo apt install pipx`; this will usually also install Python for you if
|
|
|
|
necessary. Any version of `pipx` will do. If you are installing `pipx` manually,
|
|
|
|
you may first need to follow the [Python installation instructions].
|
2023-08-18 23:43:20 +00:00
|
|
|
|
|
|
|
[Python installation instructions]: https://docs.python.org/3/using/index.html
|
|
|
|
[Poetry installation instructions]: https://python-poetry.org/docs/#installation
|
|
|
|
|
|
|
|
Once you have `poetry` installed, you should ask it to install the rest
|
|
|
|
of the required tools into a virtual environment as follows:
|
|
|
|
|
|
|
|
```shell
|
2024-05-12 22:30:26 +00:00
|
|
|
poetry install
|
2023-08-18 23:43:20 +00:00
|
|
|
```
|
|
|
|
|
2023-11-04 02:28:28 +00:00
|
|
|
You may get requests to "unlock a keyring", [an error messages about failing to
|
2024-05-12 22:30:26 +00:00
|
|
|
do so](https://github.com/python-poetry/poetry/issues/1917), or Poetry may
|
|
|
|
[simply hang indefinitely](https://github.com/python-poetry/poetry/issues/8623).
|
|
|
|
The workaround is to either to unlock the keyring or to run the following, and
|
|
|
|
then to try `poetry install` again:
|
2023-08-18 23:43:20 +00:00
|
|
|
|
|
|
|
```shell
|
|
|
|
# For sh-compatible shells or recent versions of `fish`
|
|
|
|
export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring
|
|
|
|
```
|
|
|
|
|
|
|
|
### Building the HTML docs locally (with live reload)
|
|
|
|
|
|
|
|
The HTML docs are built with [MkDocs](https://github.com/mkdocs/mkdocs). After
|
|
|
|
following the above steps, you should be able to view the docs by running
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# Note: this and all the commands below should be run from the root of
|
|
|
|
# the `jj` source tree.
|
|
|
|
poetry run -- mkdocs serve
|
|
|
|
```
|
|
|
|
|
|
|
|
and opening <http://127.0.0.1:8000> in your browser.
|
|
|
|
|
|
|
|
As you edit the `md` files, the website should be rebuilt and reloaded in your
|
|
|
|
browser automatically, unless build errors occur.
|
|
|
|
|
|
|
|
You should occasionally check the terminal from which you ran `mkdocs serve` for
|
|
|
|
any build errors or warnings. Warnings about `"GET /versions.json HTTP/1.1" code
|
|
|
|
404` are expected and harmless.
|
|
|
|
|
2023-08-26 02:52:47 +00:00
|
|
|
### How to build the entire website (not usually necessary)
|
|
|
|
|
|
|
|
The full `jj` website includes the documentation for several `jj` versions
|
|
|
|
(`prerelease`, latest release, and the older releases). The top-level
|
|
|
|
URL <https://martinvonz.github.io/jj> redirects to
|
|
|
|
<https://martinvonz.github.io/jj/latest>, which in turn redirects to
|
|
|
|
the docs for the last stable version.
|
|
|
|
|
|
|
|
The different versions of documentation are managed and deployed with
|
|
|
|
[`mike`](https://github.com/jimporter/mike), which can be run with
|
|
|
|
`poetry run -- mike`.
|
|
|
|
|
|
|
|
On a POSIX system or WSL, one way to build the entire website is as follows (on
|
|
|
|
Windows, you'll need to understand and adapt the shell script):
|
|
|
|
|
|
|
|
1. Check out `jj` as a co-located `jj + git` repository (`jj clone --colocate`),
|
|
|
|
cloned from your fork of `jj` (e.g. `jjfan.github.com/jj`). You can also use a
|
|
|
|
pure Git repo if you prefer.
|
|
|
|
|
2024-08-21 19:59:15 +00:00
|
|
|
2. Make sure `jjfan.github.com/jj` includes the `gh-pages` bookmark of the jj repo
|
2023-08-26 02:52:47 +00:00
|
|
|
and run `git fetch origin gh-pages`.
|
|
|
|
|
2023-08-28 17:30:33 +00:00
|
|
|
3. Go to the GitHub repository settings, enable GitHub Pages, and configure them
|
2024-08-21 19:59:15 +00:00
|
|
|
to use the `gh-pages` bookmark (this is usually the default).
|
2023-08-26 02:52:47 +00:00
|
|
|
|
2023-08-28 17:30:33 +00:00
|
|
|
4. Run the same `sh` script that is used in GitHub CI (details below):
|
2023-08-26 02:52:47 +00:00
|
|
|
|
|
|
|
```shell
|
|
|
|
.github/scripts/docs-build-deploy 'https://jjfan.github.io/jj/'\
|
|
|
|
prerelease main --push
|
|
|
|
```
|
|
|
|
|
|
|
|
This should build the version of the docs from the current commit,
|
2024-08-21 19:59:15 +00:00
|
|
|
deploy it as a new commit to the `gh-pages` bookmark,
|
|
|
|
and push the `gh-pages` bookmark to the origin.
|
2023-08-26 02:52:47 +00:00
|
|
|
|
|
|
|
5. Now, you should be able to see the full website, including your latest changes
|
|
|
|
to the `prerelease` version, at `https://jjfan.github.io/jj/prerelease/`.
|
|
|
|
|
|
|
|
6. (Optional) The previous steps actually only rebuild
|
|
|
|
`https://jjfan.github.io/jj/prerelease/` and its alias
|
|
|
|
`https://jjfan.github.io/jj/main/`. If you'd like to test out version switching
|
|
|
|
back and forth, you can also rebuild the docs for the latest release as follows.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
jj new v1.33.1 # Let's say `jj 1.33.1` is the currently the latest release
|
|
|
|
.github/scripts/docs-build-deploy 'https://jjfan.github.io/jj/'\
|
|
|
|
v1.33.1 latest --push
|
|
|
|
```
|
|
|
|
|
2024-08-21 19:59:15 +00:00
|
|
|
7. (Optional) When you are done, you may want to reset the `gh-bookmarks` to the
|
2023-08-26 02:52:47 +00:00
|
|
|
same spot as it is in the upstream. If you configured the `upstream` remote,
|
|
|
|
this can be done with:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# This will LOSE any changes you made to `gh-pages`
|
|
|
|
jj git fetch --remote upstream
|
2024-08-21 19:59:15 +00:00
|
|
|
jj bookmark set gh-pages -r gh-pages@upstream
|
|
|
|
jj git push --remote origin --bookmark gh-pages
|
2023-08-26 02:52:47 +00:00
|
|
|
```
|
|
|
|
|
2024-08-21 19:59:15 +00:00
|
|
|
If you want to preserve some of the changes you made, you can do `jj bookmark
|
2023-08-26 02:52:47 +00:00
|
|
|
set my-changes -r gh-pages` BEFORE running the above commands.
|
|
|
|
|
|
|
|
#### Explanation of the `docs-build-deploy` script
|
|
|
|
|
|
|
|
The script sets up the `site_url` mkdocs config to
|
|
|
|
`'https://jjfan.github.io/jj/'`. If this config does not match the URL
|
|
|
|
where you loaded the website, some minor website features (like the
|
|
|
|
version switching widget) will have reduced functionality.
|
|
|
|
|
|
|
|
Then, the script passes the rest of its arguments to `potery run -- mike
|
|
|
|
deploy`, which does the rest of the job. Run `poetry run -- mike help deploy` to
|
|
|
|
find out what the arguments do.
|
|
|
|
|
|
|
|
If you need to do something more complicated, you can use `poetry run -- mike
|
2024-08-21 19:59:15 +00:00
|
|
|
...` commands. You can also edit the `gh-pages` bookmark directly, but take care
|
2023-08-26 02:52:47 +00:00
|
|
|
to avoid files that will be overwritten by future invocations of `mike`. Then,
|
2024-08-21 19:59:15 +00:00
|
|
|
you can submit a PR based on the `gh-pages` bookmark of
|
|
|
|
<https://martinvonz.github.com/jj> (instead of the usual `main` bookmark).
|
2023-08-26 02:52:47 +00:00
|
|
|
|
|
|
|
|
2023-08-18 23:43:20 +00:00
|
|
|
## Modifying protobuffers (this is not common)
|
2023-08-18 21:03:54 +00:00
|
|
|
|
2023-04-10 05:28:51 +00:00
|
|
|
Occasionally, you may need to change the `.proto` files that define jj's data
|
|
|
|
storage format. In this case, you will need to add a few steps to the above
|
|
|
|
workflow.
|
2023-08-18 21:03:54 +00:00
|
|
|
|
2023-04-10 05:28:51 +00:00
|
|
|
- Install the `protoc` compiler. This usually means either `apt-get install
|
2023-08-18 21:03:54 +00:00
|
|
|
protobuf-compiler` or downloading [an official release]. The
|
2023-08-13 01:38:57 +00:00
|
|
|
`prost` [library docs] have additional advice.
|
2023-04-10 05:28:51 +00:00
|
|
|
- Run `cargo run -p gen-protos` regularly (or after every edit to a `.proto`
|
|
|
|
file). This is the same as running `cargo run` from `lib/gen-protos`. The
|
|
|
|
`gen-protos` binary will use the `prost-build` library to compile the
|
|
|
|
`.proto` files into `.rs` files.
|
|
|
|
- If you are adding a new `.proto` file, you will need to edit the list of
|
|
|
|
these files in `lib/gen-protos/src/main.rs`.
|
|
|
|
|
|
|
|
[an official release]: https://github.com/protocolbuffers/protobuf/releases
|
2023-08-13 01:38:57 +00:00
|
|
|
[library docs]: https://docs.rs/prost-build/latest/prost_build/#sourcing-protoc
|
2023-04-10 05:28:51 +00:00
|
|
|
|
|
|
|
The `.rs` files generated from `.proto` files are included in the repository,
|
2023-08-28 17:30:33 +00:00
|
|
|
and there is a GitHub CI check that will complain if they do not match.
|
2023-09-14 05:16:20 +00:00
|
|
|
|
|
|
|
## Profiling
|
|
|
|
|
|
|
|
One easy-to-use sampling profiler
|
|
|
|
is [samply](https://github.com/mstange/samply). For example:
|
|
|
|
```shell
|
|
|
|
cargo install samply
|
|
|
|
samply record jj diff
|
|
|
|
```
|
|
|
|
Then just open the link it prints.
|
|
|
|
|
|
|
|
Another option is to use the instrumentation we've added manually (using
|
|
|
|
`tracing::instrument`) in various places. For example:
|
|
|
|
```shell
|
|
|
|
JJ_TRACE=/tmp/trace.json jj diff
|
|
|
|
```
|
|
|
|
Then go to `https://ui.perfetto.dev/` in Chrome and load `/tmp/trace.json` from
|
|
|
|
there.
|