Commit graph

3081 commits

Author SHA1 Message Date
Yuya Nishihara
6c5947181d cli: reimplement "debug resolverev" as command to debug print revset
Also removed -r/--revision and the default "@" as it is a debug command.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
429562ca2f revset: implement Debug for RevsetImpl and add trait bound accordingly 2023-04-02 22:54:46 +09:00
Yuya Nishihara
2aab6c7825 revset: implement Debug for InternalRevset objects
Even though predicate function and RevWalk internals can't be debug printed,
it's useful to see an overview of InternalRevset tree.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
b297b7c965 revset: turn PurePredicateFn into newtype struct
This will avoid extra boxing when converting PurePredicateFn to dyn
ToPredicateFn object.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
fbb292f7c9 revset: relax lifetime bound of ToPredicateFn
We don't have to require that the input IndexEntry<'_> has 'index lifetime.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
2404dc8cd3 revset: remove redundant type bound from RevWalkRevset
The "'index: 'a" bound can be removed by bypassing the Box<dyn> indirection
of self.iter().
2023-04-02 22:54:46 +09:00
Ilya Grigoriev
a58af4f19d Work around a couple of false positives for recent nightly clippy
This is likely https://github.com/rust-lang/rust-clippy/issues/10577
2023-04-01 18:35:38 -07:00
Yuya Nishihara
5a771c913b cli: unify "bench revset"/"revsets" commands 2023-04-01 22:52:11 +09:00
Yuya Nishihara
6c6fdae88d cli: allow to run "jj bench revset" for more than one revsets 2023-04-01 11:13:05 +09:00
Yuya Nishihara
a27fb79e96 cli: fix completion of "jj bench revsets FILE" argument 2023-04-01 11:13:05 +09:00
Yuya Nishihara
4ff5c52edc cli: expose some criterion options as bench command args
I want to adjust --sample-size while running slow revset benchmarks. The
baseline option seems also useful.

Short options are derived from Criterion::configure_from_args().
2023-04-01 11:13:05 +09:00
Yuya Nishihara
8a796cd98c cli: copy color output option to Criterion 2023-04-01 11:13:05 +09:00
Yuya Nishihara
9f1dc8f67c cli: remove excessive newline from "jj bench revset(s)" output 2023-04-01 11:13:05 +09:00
dependabot[bot]
0f108e278d cargo: bump pest from 2.5.6 to 2.5.7
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.6 to 2.5.7.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.6...v2.5.7)

---
updated-dependencies:
- dependency-name: pest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-31 09:27:29 -07:00
dependabot[bot]
b62cccf6dc cargo: bump dirs from 4.0.0 to 5.0.0
Bumps [dirs](https://github.com/soc/dirs-rs) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

---
updated-dependencies:
- dependency-name: dirs
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-31 09:23:21 -07:00
Martin von Zweigbergk
68ea927c66 cli: move default ui.pager config to misc.toml 2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
5ae6698f81 cli: report invalid ui.pager config value
If you set e.g.`ui.pager = 5`, we currently ignore that and fall back
to the default. It seems better to let the user know that their config
is invalid, as we generally do. This commit does that. With this
change, the error message will look like this:

```
Config error: Invalid `ui.pager`: data did not match any variant of untagged enum CommandNameAndArgs
```

Maybe the key name will be redundant once the `config` crate releases
a version including https://github.com/mehcode/config-rs/pull/413
(thanks, Yuya).
2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
5fe5991ca8 cli: on config error, point to documentation 2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
3546cc1bf6 revset: pass in store, index, and heads instead of whole Repo
The `Repo` is a higher-level type that the index shouldn't have to
know about. With this change, a custom revset implementation should be
able evaluate the revset on a server without knowing which repo it
refers to.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
9f9e356f3d revset: use the default index impl more in default revset engine
We already pass a `CompositeIndex` to
`default_revset_engine::evaluate()` so let's use that wherever we
currently use `repo.index()`. That will help us remove the `repo`
argument, and it will also let us internal types (like `IndexEntry`)
in the index methods we call.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
002ec1ac68 revset: move internal_evaluate() onto new context type
I'm about to replace the `&dyn Repo` argument by several smaller
types, and it's easier to collect those in a single context type than
to pass them separately as arguments.

I also moved `revset_for_commit_ids()` and `take_latest_revset()` onto
the new type because it was easy. `build_predicate_fn()` and
`has_diff_from_parent()` ran into some lifetime issue when I tried.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
3ff1ab520b revset: remove public_heads()
The `public_heads()` revset only contains the root commit in
practice. I'm not sure what we want to do about phases, but since we
don't have any real support for them yet, let's just remove this
revset. I didn't update the changelog because we don't seem to have
documented the revset function (and it seems unlikely that users who
found out about it found it useful enough to use it when they could
just use `root`).
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
2a3d402d0c revset: also resolve branches(), tags(), etc. when resolving symbols
This is another step towards removing the `Repo` argument from
`Index::evaluate_revset()`.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
6643fb2bff op_store: inline ProtoOpStore into SimpleOpStore
The `ProtoOpStore` was separated out to simplify the migration from
Thrift. Now that the `ThriftOpStore` is gone, we can inline
`ProtoOpStore` as the TODO says.
2023-03-30 20:00:33 -07:00
Martin von Zweigbergk
68fb46b2af op_store: drop support for upgrading from Thrift implementation 2023-03-30 20:00:33 -07:00
Martin von Zweigbergk
b707a29f41 github: fix name of workflow for Dependabot auto-merge
I apparently forgot to update the name when I copied `build.yml`.
2023-03-30 19:29:18 -07:00
Waleed Khan
d9a5869bcd github: add feature request issue template
I just added the default feature request template.
2023-03-30 11:49:04 -07:00
Waleed Khan
4c629f3aa6 cli: add warrant to identity-not-configured message
The impact of not having configured one's name and email is not apparent from the warning message. Under the Toulmin model:

- Claim (implicit): You should configure your name and email.
- Grounds: Your name and email are not currently configured.
- Warrant (currently missing): Configuring your name and email will let you do...
2023-03-30 11:43:30 -07:00
dependabot[bot]
bf03e557c1 cargo: bump clap from 4.1.9 to 4.1.11
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.9 to 4.1.11.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.1.9...v4.1.11)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 16:56:12 +00:00
dependabot[bot]
fa9cc70471 cargo: bump clap_complete from 4.1.5 to 4.2.0
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.1.5 to 4.2.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.1.5...clap_complete-v4.2.0)

---
updated-dependencies:
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 16:44:06 +00:00
dependabot[bot]
8dea96e1ae github: bump ossf/scorecard-action from 2.1.2 to 2.1.3
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](e38b1902ae...80e868c13c)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 16:42:02 +00:00
dependabot[bot]
0d581809fc cargo: bump tempfile from 3.4.0 to 3.5.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/commits)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 16:38:19 +00:00
Martin von Zweigbergk
9d83c40b8d github: add a build target with all features
This should catch build errors in the `bench` feature (and in any
future non-default features).
2023-03-30 09:20:29 -07:00
Martin von Zweigbergk
0e29cfca5c github: simplify build matrix definition
See https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
2023-03-30 09:20:29 -07:00
Yuya Nishihara
a03e9c41a3 cli: run revset bench with fresh (but index-preloaded) repo instance
Some benchmark numbers in the following order:
- original
- fresh repo, BatchSize::SmallInput
- fresh but index-preloaded repo, BatchSize::SmallInput
- fresh but index-preloaded repo, BatchSize::LargeInput

    % cargo run --release --features bench -- bench revset ':main'
    revsets/:main           time:   [271.49 µs 271.74 µs 272.07 µs]
    revsets/:main           time:   [754.17 µs 758.22 µs 764.02 µs]
    revsets/:main           time:   [367.11 µs 372.65 µs 381.99 µs]
    revsets/:main           time:   [341.76 µs 342.98 µs 344.35 µs]

    % cargo run --release --features bench -- bench revset 'author(martinvonz)'
    revsets/author(martinvonz)
                            time:   [767.43 µs 770.52 µs 775.59 µs]
    revsets/author(martinvonz)
                            time:   [31.960 ms 31.984 ms 32.011 ms]
    revsets/author(martinvonz)
                            time:   [31.478 ms 31.538 ms 31.615 ms]
    revsets/author(martinvonz)
                            time:   [31.503 ms 31.526 ms 31.550 ms]

I think the fresh but index-preloaded repo is close to the practical
evaluation environment. With BatchSize::SmallInput, it appears to consume
~600MB (RES) memory (compared to ~50MB in LargeInput.) I don't think that's
huge, but it might affect cache usage, so I chose LargeInput.

https://docs.rs/criterion/latest/criterion/enum.BatchSize.html
2023-03-30 19:13:11 +09:00
Yuya Nishihara
db516081de cli: leverage bench_with_input() to make revset expression opaque to optimizer
I don't think this would matter since the revset evaluation is behind virtual
dispatch, but let's follow the general guideline.

https://bheisler.github.io/criterion.rs/book/user_guide/benchmarking_with_inputs.html#benchmarking-with-one-input
2023-03-30 19:13:11 +09:00
Yuya Nishihara
ce1f9ab9e5 cli: extract helper for revset benchmark
The benchmark ids slightly changed, but I think it's better to share the
target/criterion/revsets directory.
2023-03-30 19:13:11 +09:00
Martin von Zweigbergk
0f23ad46f3 docs: add note that co-located mode helps when tools expect a Git repo 2023-03-29 11:25:47 -07:00
Martin von Zweigbergk
6ff7686b69 docs: finally describe what we mean by "co-located repos" 2023-03-29 11:25:47 -07:00
B Wilson
01a9ce0c71 diff: Treat multi-byte UTF-8 runes as word characters
Inline diffs on multi-byte UTF-8 characters would match individual
bytes, causing garbled diffs in some cases. For example, replacing
`⊢` with `⊣`, which differ in the final byte only, caused the
diff to display a diff of the bytes instead the character.

This commit uses a workaround present in Mercurial by treating all
bytes 0x80 and above as word characters, causing any multi-byte
character to be treated as a word and not segmented.

https://www.mercurial-scm.org/repo/hg/file/6.3.3/mercurial/patch.py#l51
2023-03-30 00:06:56 +09:00
dependabot[bot]
7aad2aea8a cargo: bump serde from 1.0.158 to 1.0.159
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.158 to 1.0.159.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.158...v1.0.159)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-28 17:28:01 +00:00
Martin von Zweigbergk
f7dbade07a cli: add a command for benchmarking many revsets
This command is similar to Mercurial's revset benchmarking command. It
lets you pass in a file containing revsets. I also included a file
with some revsets to test on the git.git repo. I put it in `testing/`,
which doesn't seem perfect. I'm happy to hear suggestions for better
places, or we can move it later if we find a better place.

Note that these tests don't clear caches between each run (or even
between tests), so revsets that rely on filtering commit data that's
not indexed appear faster than they typically are in reality.
2023-03-28 10:21:10 -07:00
Martin von Zweigbergk
7249be33b0 cli: replace jj bench walkrevs by generic jj bench revset
I suspect the `jj bench walkrevs` command was from before we had
support for revsets. Now there doesn't seem to be any reason to have a
specific command for only range revsets (`foo..bar`), so let's replace
it by a command for benchmarking an arbitrary revset.
2023-03-28 10:21:10 -07:00
Martin von Zweigbergk
327deeb0c4 cli: move jj bench commands to new module, hide behind feature flag
The `jj bench` commands are mostly meant for developers, so lets hide
the command from help and behind a `bench` feature flag. The feature
flags avoids bloating the binary with the `criterion` dependencies,
which was the reason I removed the command in 18c0b97d9d.
2023-03-28 10:21:10 -07:00
Martin von Zweigbergk
48fbf7e1bd cli: revive jj bench command
This just backs out commit 18c0b97d9d without making any changes,
except for resolving conflicts.

I want a way to benchmark different revsets on e.g. the Git Core repo
or the Linux repo.
2023-03-28 10:21:10 -07:00
dependabot[bot]
05e6609efc cargo: bump serde_json from 1.0.94 to 1.0.95
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.94 to 1.0.95.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.94...v1.0.95)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-28 10:16:06 -07:00
dependabot[bot]
77164d6456 cargo: bump regex from 1.7.2 to 1.7.3
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.7.2...1.7.3)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 16:22:29 +00:00
dependabot[bot]
c379c9740d github: bump github/codeql-action from 2.2.8 to 2.2.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.8 to 2.2.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](67a35a0858...04df1262e6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 16:16:55 +00:00
dependabot[bot]
b1d4033558 cargo: bump indexmap from 1.9.2 to 1.9.3
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.9.2 to 1.9.3.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/bluss/indexmap/compare/1.9.2...1.9.3)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 16:15:34 +00:00
dependabot[bot]
4a0193ccec github: bump EmbarkStudios/cargo-deny-action from 1.4.0 to 1.5.0
Bumps [EmbarkStudios/cargo-deny-action](https://github.com/EmbarkStudios/cargo-deny-action) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/EmbarkStudios/cargo-deny-action/releases)
- [Commits](8a8607bd8e...8af37f5d0c)

---
updated-dependencies:
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 16:13:21 +00:00