Commit graph

3044 commits

Author SHA1 Message Date
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
Yuya Nishihara
75988118d3 benches: group unchanged/modified/reversed-line diffs together
Criterion can summarize the grouped benchmarks, which seemed somewhat useful.
2023-03-27 23:38:56 +09:00
Yuya Nishihara
0087f988f7 benches: drop dependency on criterion_bencher_compat 2023-03-27 23:38:56 +09:00
Yuya Nishihara
91d0c28080 benches: move diff_bench to lib crate
It has no dependency on the cli crate.
2023-03-27 23:38:56 +09:00
Yuya Nishihara
7ebffe8e6f cargo: sort dependencies in lexicographical order
This should help future cargo add.
2023-03-27 23:38:56 +09:00
David Barnett
329720821b Move .envrc to .envrc.recommended to make it opt-in 2023-03-26 21:55:12 -06:00
David Barnett
ded62ff566 .envrc: Check for nix before trying to use flake 2023-03-25 16:19:08 -07:00
Yuya Nishihara
0532301e03 revset: add latest(candidates, count) predicate
This serves the role of limit() in Mercurial. Since revsets in JJ is
(conceptually) an unordered set, a "limit" predicate should define its
ordering criteria. That's why the added predicate is named as "latest".

Closes #1110
2023-03-25 23:48:50 +09:00
Yuya Nishihara
185549f031 revset: extract helper to parse literal to e.g. usize 2023-03-25 23:48:50 +09:00
Yuya Nishihara
d04556cf18 revset: use unstable sort to enforce ordering of commit ids
This wouldn't matter in practice, but there should be no reason to stick
to stable sort.
2023-03-25 23:48:50 +09:00
Martin von Zweigbergk
bac2de6ac6 cli: add hint about testing with ssh -F /dev/null on SSH errors 2023-03-24 22:16:50 -07:00
Martin von Zweigbergk
d4a98aed7d cargo: remove unused dependency predicates crate 2023-03-24 13:04:14 -07:00
Martin von Zweigbergk
4e60e69208 readme: remove pointer to closed issue about native backend 2023-03-24 11:42:41 -07:00
Martin von Zweigbergk
6c28ec1608 cli: find working copy's first parent from commit store (not index)
This avoid another use of `IndexEntry`. The working-copy commit should
be in the cache here, so it shouldn't have any impact on performance.
2023-03-24 10:09:40 -07:00
Martin von Zweigbergk
ce5c90b4e5 revset: use Index::has_id() for checking if a commit has been indexed
This avoids another use of `IndexEntry`.
2023-03-24 10:09:40 -07:00
Martin von Zweigbergk
baea314fc0 index: get generation number from specific impl in test 2023-03-24 10:09:40 -07:00
Martin von Zweigbergk
a5b79f9b0e index: make topo_order() return commit ids instead of index entries
`IndexEntry` is specific to the default index store; we don't want it
in the interface.
2023-03-24 10:09:40 -07:00
Martin von Zweigbergk
772cb1a0e9 revset: replace an unnecessary iterator adapter by a simple map()
As noted by @yuja in #1423.
2023-03-24 10:09:40 -07:00
dependabot[bot]
5b2e1cbe07 github: bump actions/checkout from 3.4.0 to 3.5.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](24cb908017...8f4b7f8486)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 10:08:02 -07:00
dependabot[bot]
216e4e1dd1 cargo: bump predicates from 2.1.5 to 3.0.2
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 2.1.5 to 3.0.2.
- [Release notes](https://github.com/assert-rs/predicates-rs/releases)
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v2.1.5...v3.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 10:06:15 -07:00
Martin von Zweigbergk
75605e36af revset: iterate over commit ids instead of index entries
There are no remaining places where we iterate over a revset and need
the `IndexEntry`s, so we can now make `Revset::iter()` yield
`CommitId`s instead.
2023-03-23 21:58:15 -07:00
Martin von Zweigbergk
b5ea79f32e revset: add new graph iterator function for tests
I'm about to make `Revset::iter()` yield just `CommitId`s, but the
tests in `test_default_revset_graph_iterator.rs` need an `IndexEntry`
iterator so they can pass it into `RevsetGraphIterator::new()`. This
commits prepares for the change by adding a
`RevsetImpl::iter_graph_impl()` that returns `RevsetGraphIterator`,
keeping `InternalRevset` still hidden within the revset engine. We
could instead have made that (and `ToPredicateFn`) visible to tests. I
can't say which is better.
2023-03-23 21:58:15 -07:00
Martin von Zweigbergk
c8f387d5b3 revset: pass IndexEntry iterator to graph iterator
The graph iterator is specific to the index implementation, and it
needs access to `IndexEntry`, which `Revset::iter()` will soon not
yield.
2023-03-23 21:58:15 -07:00
Martin von Zweigbergk
0b506d8461 index: remove position-based methods 2023-03-23 20:49:15 -07:00
Martin von Zweigbergk
d4e1156957 repo: move IdIndex to revset engine 2023-03-23 20:49:15 -07:00
Martin von Zweigbergk
13a000caa7 repo: get change id index from revset also for mutable repo
I don't know if we ever resolve revsets in a mutable repo, but now
that we can get a change id index from a revset, it's easier to
implement this functionality that way.
2023-03-23 20:49:15 -07:00
Martin von Zweigbergk
68cff2fa22 repo: get change id index from revset instead of building it in repo
This replaces the direct use of `IdIndex` in `ReadonlyRepo` by use of
`Revset::change_id_index()`.

I made the `Index` trait require `Send` and `Sync` in order to be able
to store an instance of it in `ReadonlyRepo` (via `ChangeIdIndex`) and
still have that be `Send` and `Sync`. We could alternatively store the
`ChangeIdIndex` in a `Mutex`. Now that will be up to the
`ChangeIdIndex` instead.
2023-03-23 20:49:15 -07:00
Martin von Zweigbergk
27a7fccefa revset: add a method returning a change id index
One of the remaining places we depend on index positions is when
creating a `ChangeIdIndex`. This moves that into the revset engine
(which is coupled to the commit index implementation) by adding a
`Revset::change_id_index()` method. We will also use this function
later when add support for resolving change id prefixes within a small
revset.

The current implementation simply creates an in-memory index using the
existing `IdIndex` we have in `repo.rs`.

The custom implementation at Google might do the same for small
revsets that are available on the client, but for revsets involving
many commits on the server, it might use a suboptimmal implementation
that uses longer-than-necessary prefixes for performance reasons. That
can be done by querying a server-side index including changes not in
the revset, and then verifying that the resulting commits are actually
in the revset.
2023-03-23 20:49:15 -07:00
Martin von Zweigbergk
a65e0e771c revset: remove unnecessary wrapping of every node in RevsetImpl
Thanks to @yuja for the suggestion.
2023-03-23 20:49:15 -07:00
Yuya Nishihara
75d68fe24c templater: add "parents" keyword in place of "parent_commit_ids"
All commit keywords are mapped to nullary methods. No matter if we'll
introduce .field syntax and/or self. keyword, this implementation can be
reused.
2023-03-24 12:17:38 +09:00
Yuya Nishihara
f4235464c2 templater: extract function that builds commit keywords over property
New code inserts one more Commit::clone(), but I don't see a measurable cost
with "jj log -Tshow -r 'all()'".
2023-03-24 12:17:38 +09:00
Yuya Nishihara
90f27555e7 templater: remove repo reference from CommitOrChangeId
A repo reference is passed around by the language struct, so it's no longer
needed to embed in CommitOrChangeId.
2023-03-24 12:17:38 +09:00
Yuya Nishihara
9065b94dc1 templater: implement list methods for unformattable property 2023-03-24 12:17:38 +09:00
Yuya Nishihara
a0be6a5a11 templater: add support for unformattable property
A property of Commit type won't have a default format.
2023-03-24 12:17:38 +09:00
dependabot[bot]
97a076f2da github: bump github/codeql-action from 2.2.7 to 2.2.8
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.7 to 2.2.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](168b99b3c2...67a35a0858)

---
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-23 09:35:34 -07:00
dependabot[bot]
f1775d5cea cargo: bump toml_edit from 0.19.7 to 0.19.8
Bumps [toml_edit](https://github.com/ordian/toml_edit) from 0.19.7 to 0.19.8.
- [Release notes](https://github.com/ordian/toml_edit/releases)
- [Commits](https://github.com/ordian/toml_edit/compare/v0.19.7...v0.19.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 09:35:10 -07:00
dependabot[bot]
4dc97de928 cargo: bump insta from 1.28.0 to 1.29.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.28.0 to 1.29.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.28.0...1.29.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 09:34:27 -07:00
Yuya Nishihara
9d661d6f69 cli: render other kind of revset error suggestion as hint 2023-03-23 23:08:17 +09:00