ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

3031 commits

Author SHA1 Message Date
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
Yuya Nishihara
ddeb645d7f cli: provide hint for typo of revset function name
This is similar to what Mercurial does. The similarity threshold is copied
from clap, but we might want to adjust it later.
2023-03-23 23:08:17 +09:00
Yuya Nishihara
d3d8afc77b revset: rewrite match table of builtin functions as HashMap
So that we can build a list of function names.
2023-03-23 23:08:17 +09:00
Martin von Zweigbergk
9ed537b3e8 cli: leverage RevsetIteratorExt::commits() in jj log
I'm trying to remove uses of `IndexEntry`.
2023-03-23 04:50:33 -07:00
Martin von Zweigbergk
5709822f05 rewrite: keep commits to visit instead of looking up again
Since the commits are cached in `Store`, this doesn't have any impact
on performance, but it's a little simpler.
2023-03-23 04:50:33 -07:00
Martin von Zweigbergk
e81890b319 rewrite: work with commits instead of index entries in setup code
When deciding the order to visit commits to rebase, we currently look
up parents in the index. I'm trying to remove the current `IndexEntry`
type and will probably have revsets iterators yield simply
`CommitId`. Let's therefore look up commit objects here.

I timed this by rewriting all commits in the jj repo. I couldn't
measure any difference. That makes sense since we cache the commits in
`Store` and we would read the commit when rebasing it anyway.
2023-03-23 04:50:33 -07:00
Martin von Zweigbergk
d3cf543abc revset: move revset_for_commits() to test
The function is only used in tests, so it doesn't belong in
`default_revset_engine`. Also, it's not specific to that
implementation, so I rewrote as a revset evaluation.
2023-03-23 04:50:33 -07:00
Yuya Nishihara
2a87e1f95a cli: call RevsetExpression::evaluate() directly if no symbol resolution needed
There should be no problem to evaluate revset against base_repo and collect
commit objects from (mut_)repo, but it seemed a bit odd.

In rebase examples other than the "new --insert-after", we could switch to
tx.repo(). However, I think the use of tx.base_repo() makes it clear that
there's no data dependency on the previous mutation.
2023-03-23 01:15:31 +09:00
Christophe Poucet
c5503cee84 Seems like it's referring to the wrong commit? 2023-03-21 21:44:15 -07:00
Martin von Zweigbergk
5f74dd5db3 repo: implement Repo on ReadonlyRepo instead of its Arc
I'd like to be able to pass a `self` of `type `&ReadonlyRepo` to
functions that take a `&dyn Repo`. For that, we need `ReadonlyRepo`
itself to implement `Repo` instead of having `Arc<ReadonlyRepo>`
implement it. I could have solved it in a different way, but the `Arc`
requirement seems like an unnecessary constraint.
2023-03-21 21:43:44 -07:00
Martin von Zweigbergk
58e153af19 cli: use Transaction::repo() instead of base_repo() when possible
In most cases, we just need to access the commit backend and then the
shorter `base()` works. I noticed because I wanted to implement `Repo`
on `ReadonlyRepo` instead of on `Arc<ReadonlyRepo>` and then these
uses failed.
2023-03-21 21:43:44 -07:00
Martin von Zweigbergk
d089c22232 repo: move base_repo() off of Repo trait
We only ever call `base_repo()` on `MutableRepo` instances.
2023-03-21 21:43:44 -07:00
Martin von Zweigbergk
ea498df539 repo: when resolving change id prefix, directly return commit ids
The functions resolving a change id to commits currently return a
`Vec<IndexEntry>`. We want to avoid depending on `IndexEntry` and we
only need the commit ids here.
2023-03-21 21:43:44 -07:00
Anton Bulakh
3c68cfa737 nix: fix shell completions 2023-03-22 06:20:15 +02:00