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

5617 commits

Author SHA1 Message Date
Khionu Sybiern
289b9bc71f cli: update help message for jj edit
This change updates the language of `jj edit`'s help message to be
more clear as to the nature of the command. It also adds a 
recommendation for a more idiomatic/safer workflow.
2024-03-14 11:32:53 -07:00
Evan Mesterhazy
f30857190e Add more test cases for Index::common_ancestors 2024-03-14 12:54:13 -04:00
Evan Mesterhazy
adaedd5556 Add documentation to lib/src/index.rs and lib/src/default_index/ 2024-03-14 12:54:13 -04:00
Yuya Nishihara
e3303efcf3 cli_util: inline WorkspaceCommandHelper::check_non_empty()
It's simple, and has no data dependency.
2024-03-14 23:51:21 +09:00
Yuya Nishihara
218b1c6c16 commit_templater: add self.immutable() method
I don't know how immutable revisions should be labeled by default, but users
can customize templates whatever they like.
2024-03-14 22:59:43 +09:00
Yuya Nishihara
04d5f59cbb templater: do not rewrite non-argument errors raised from self methods
I'm going to add new "self.immutable()" method, which takes no arguments but
can fail if the configured revset is wrong.
2024-03-14 22:59:43 +09:00
Yuya Nishihara
78104b5e82 cli: extract function that stringifies RevsetParseError 2024-03-14 22:59:43 +09:00
Yuya Nishihara
34eb446037 cli: remove CommandError dependency from revset_util::evaluate()
This function will be called from the templater.
2024-03-14 22:59:43 +09:00
Yuya Nishihara
7dfe04134d cli: check invalid declaration of immutable_heads() alias earlier
I just wanted to remove CommandError from parse_immutable_expression(), which
will be called from the templater, but the new error message looks also better.
2024-03-14 22:59:43 +09:00
Yuya Nishihara
8235e458ed cli: extract primitives for user revset parsing and evaluation
Some of them will be called directly from the commit templater which shouldn't
know WorkspaceCommandHelper. All parameters are passed as function arguments
instead of having a nicer wrapper struct. That's because some resources (e.g.
repo and id prefix context) are also used for different purposes, and it seemed
uneasy to introduce high-level abstraction satisfying all the use cases.
2024-03-14 22:59:43 +09:00
TrashCan
33911712a2 Add archlinux instructions to install-and-setup.md
based upon #3289 by @roland-5
2024-03-13 21:35:08 -07:00
Yuya Nishihara
5806dbfd32 revset_graph: detach CompositeIndex, reimplement as RevWalk
For API consistency. It wouldn't practically matter unless we want to reuse
.iter_graph() in lazy event-driven GUI context.

I don't see significant performance difference:
- jj-0: original impl with look-ahead IndexEntry<'_> buffer
- jj-1: this patch

With dense graph
```
% hyperfine --sort command --warmup 3 --runs 10 -L bin jj-0,jj-1 \
  "target/release-with-debug/{bin} -R ~/mirrors/git --ignore-working-copy log -r.. -T ''"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/git --ignore-working-copy log -r.. -T ''
  Time (mean ± σ):      1.367 s ±  0.008 s    [User: 1.261 s, System: 0.105 s]
  Range (min … max):    1.357 s …  1.380 s    10 runs

Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/git --ignore-working-copy log -r.. -T ''
  Time (mean ± σ):      1.344 s ±  0.017 s    [User: 1.245 s, System: 0.099 s]
  Range (min … max):    1.313 s …  1.369 s    10 runs

Relative speed comparison
        1.02 ±  0.01  target/release-with-debug/jj-0 -R ~/mirrors/git --ignore-working-copy log -r.. -T ''
        1.00          target/release-with-debug/jj-1 -R ~/mirrors/git --ignore-working-copy log -r.. -T ''
```

With sparse graph
```
% hyperfine --sort command --warmup 3 --runs 10 -L bin jj-0,jj-1 \
  "target/release-with-debug/{bin} -R ~/mirrors/git --ignore-working-copy log -r'tags()' -T ''"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/git --ignore-working-copy log -r'tags()' -T ''
  Time (mean ± σ):      1.347 s ±  0.017 s    [User: 1.216 s, System: 0.130 s]
  Range (min … max):    1.321 s …  1.379 s    10 runs

Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/git --ignore-working-copy log -r'tags()' -T ''
  Time (mean ± σ):      1.379 s ±  0.023 s    [User: 1.238 s, System: 0.140 s]
  Range (min … max):    1.328 s …  1.403 s    10 runs

Relative speed comparison
        1.00          target/release-with-debug/jj-0 -R ~/mirrors/git --ignore-working-copy log -r'tags()' -T ''
        1.02 ±  0.02  target/release-with-debug/jj-1 -R ~/mirrors/git --ignore-working-copy log -r'tags()' -T ''
```
2024-03-14 10:07:19 +09:00
Yuya Nishihara
3c8f22456b revset_graph: remove lifetimed IndexEntry<'_> from look_ahead buffer
Prepares for removing &CompositeIndex from the RevsetGraphIterator struct.
The input iterator will also be changed to position-based.

I've turned self.look_ahead.get().unwrap() into assertion, but it's not super
important here. It's just for sanity that we've mapped missing edges properly.
FWIW, we could say RevsetGraphIterator is an example of iterating *and* testing
membership of the input revset (though the yielded entries are discarded.)
2024-03-14 10:07:19 +09:00
Yuya Nishihara
699707905c index: reorganize revset_graph_iterator as private module of default_index
The RevsetGraphIterator type is hidden so that the Iterator trait can be
implemented differently.
2024-03-14 10:07:19 +09:00
mrstanwell
4d71ef1518 docs: Fix FAQ reference to glossary entry for co-located repos
In the FAQ question "How do I integrate Jujutsu with Gerrit?", the link
to the glossary entry for "co-located repos" was pointing to the entry
for "change-id".
2024-03-13 14:14:12 -07:00
Martin von Zweigbergk
93f651d597 next/prev: make first line of help text consistent
This drops the trailing period for consistency with other commands,
and rephrases them a bit for consistency between each other.
2024-03-13 11:11:20 -07:00
dependabot[bot]
4fcee9b3f6 github: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) and [DeterminateSystems/magic-nix-cache-action](https://github.com/determinatesystems/magic-nix-cache-action).


Updates `DeterminateSystems/nix-installer-action` from 9 to 10
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](cd46bde16a...de22e16c47)

Updates `DeterminateSystems/magic-nix-cache-action` from 3 to 4
- [Release notes](https://github.com/determinatesystems/magic-nix-cache-action/releases)
- [Commits](eeabdb0671...fc6aaceb40)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
- dependency-name: DeterminateSystems/magic-nix-cache-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 12:05:44 -05:00
Yuya Nishihara
a3839cdf47 commit_templater: allow extension methods to capture repo 2024-03-14 00:00:18 +09:00
Yuya Nishihara
9b42c81d6f templates: add missing "\n" to builtin "root" output 2024-03-13 23:29:27 +09:00
Martin von Zweigbergk
800f0f0347 squash: accept multiple --from revisions
Now you can do e.g. `jj squash --from 'foo+::' --into foo` to squash a
whole series into one commit. It doesn't need to be linear; you can
squash a bunch of siblings into another siblings, for example.
2024-03-13 05:21:05 -07:00
Martin von Zweigbergk
f3e35f1da4 description_utils: teach combine_messages() to handle more than two sources
I plan to teach `jj squash --from` to accept a revset as input.
2024-03-13 05:21:05 -07:00
Martin von Zweigbergk
2b8988c620 description_util: make combine_messages() not handle abandoned commit
I'm going to teach the function to support combining more than two
descriptions.
2024-03-13 05:21:05 -07:00
Yuya Nishihara
17e46e0932 revset: extend lifetime of CommitId/ChangeId iterators
For the same reason as the previous commit. Since self.inner.positions()
basically clones the underlying evaluation tree, there is no reason to stick
to &self lifetime. Perhaps, some of the CLI utility can be changed to not
collect() the iterator.

Migrating iter_graph() requires non-trivial changes, so it will be done
separately.
2024-03-13 10:47:58 +09:00
Yuya Nishihara
3bf41d0c52 revset: extend lifetime of containing_fn()
This allows callers to cache the returned function at 'index lifetime. It's
important in templater. It also means the returned function could be 'static
if the index were Arc<_> and we had a trait interface to achieve that.

Option<Box<dyn ..>> is removed since RevWalk is fused.
2024-03-13 10:47:58 +09:00
Yuya Nishihara
027bd8f03a revset: extend lifetime of internal evaluation nodes
This makes the whole evaluation tree 'static, and we can freely move it without
keeping the root RevsetImpl object alive.

Perhaps, "Self: 'a" can be replaced with 'static, but let's leave it for now.
It's not technically wrong to store lifetimed object in InternalRevset.
2024-03-13 10:47:58 +09:00
Yuya Nishihara
bc49b6b190 revset: make PurePredicateFn clonable
Prepares for dropping &self lifetime from to_predicate_fn(). All predicate
functions could be wrapped as Box::new(PurePredicateFn(Rc::new(f))) instead, but
I don't think the .clone() cost matters.
2024-03-13 10:47:58 +09:00
dploch
84118e1edd commit_templater: add an AnyMap for extensions to cache their own info 2024-03-12 16:52:49 -04:00
dploch
6e8f1fb390 extensions_map: create a type-safe container for arbitrary objects 2024-03-12 16:52:49 -04:00
dependabot[bot]
99e8b51182 github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-12 12:13:13 -05:00
dependabot[bot]
cca3ea1ebc cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [anyhow](https://github.com/dtolnay/anyhow), [proc-macro2](https://github.com/dtolnay/proc-macro2) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `anyhow` from 1.0.80 to 1.0.81
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.80...1.0.81)

Updates `proc-macro2` from 1.0.78 to 1.0.79
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.78...1.0.79)

Updates `thiserror` from 1.0.57 to 1.0.58
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.57...1.0.58)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-12 12:12:59 -05:00
Yuya Nishihara
283907418a revset: detach index from InternalRevset::positions()
Perhaps, union/intersection/difference combinators can be moved to the
rev_walk module, but let's think about that later.
2024-03-12 20:59:38 +09:00
Yuya Nishihara
78dbaba4dc revset: remove entry-based API from InternalRevset
Now all source/sink nodes produce/consume IndexPosition, so it doesn't make
sense to keep InternalRevset::entries().
2024-03-12 20:59:38 +09:00
Yuya Nishihara
a733b0b052 revset: detach index from predicate fn, turn it into position-based
This is the step towards removing &CompositeIndex references from the revset
evaluation tree. The filter input is changed from &IndexEntry to IndexPosition
to simplify the lifetime thingy. We might want to pass around CommitId or
Commit object once it's loaded, but that can be implemented later. I don't
see significant performance difference in revset benches.
2024-03-12 20:59:38 +09:00
Yuya Nishihara
97e69d1dcc index: add filter RevWalk adapter
FilterRevset will be built on top.
2024-03-12 20:59:38 +09:00
Yuya Nishihara
cfa067a0a9 index: add peekable RevWalk adapter
This helps to migrate union/intersection/difference iterators to RevWalk.
2024-03-12 20:59:38 +09:00
Yuya Nishihara
8f0b9a0e4a index: add RevWalk wrapper for eagerly evaluated set
This serves the same role as templater::Literal. I'm going to add basic
RevWalk adapters so that the revset evaluation tree can be constructed without
capturing the index. EagerRevWalk will help to write tests for these adapters.
2024-03-12 20:59:38 +09:00
Yuya Nishihara
7d43a5c2c0 tests: alias index.as_composite() in revset combinator/accumulator tests 2024-03-12 20:59:38 +09:00
Aleksey Kuznetsov
6fd15dc7e5 graphlog: refactor out node symbols from GraphLog
Now as default and elided node symbols come from the config, the next logical
step is to use them directly bypassing GraphLog. Note that commands like `jj op
log` and `jj obslog` do not use the elided node symbol at all.
2024-03-12 08:25:58 +05:00
Martin von Zweigbergk
e579bbad0c log: enable synthetic elided nodes by default
We're early in the release cycle, so let's enable this feature and
test it for a while before the next release.
2024-03-11 10:08:28 -07:00
Martin von Zweigbergk
8a7ccb1177 log: add some documentation
The `jj log` command had basically no documentation. Let's at least
start adding some.
2024-03-11 10:08:28 -07:00
Martin von Zweigbergk
e9655dba13 move: deprecate the command
Per discussion in
https://github.com/martinvonz/jj/discussions/2882. `jj squash` now has
all the functionality.
2024-03-11 09:25:17 -07:00
Martin von Zweigbergk
e6ef217d90 squash: learn --from/--into flags
This was proposed by @Brixy in
https://github.com/martinvonz/jj/discussions/2882 a while ago. There
seems to be pretty strong consensus that it's a good idea.

I've copied the added test cases from `test_move_command.rs`, just
replacing `move` by `squash`, `--to` by `--into`, and deleting the
test of a no-arg invocation (`jj move` fails, `jj squash` does not -
it defaults to squashing into the parent).
2024-03-11 09:25:17 -07:00
dependabot[bot]
b6655049bc cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [minus](https://github.com/arijit79/minus) and [whoami](https://github.com/ardaku/whoami).


Updates `minus` from 5.5.3 to 5.6.0
- [Changelog](https://github.com/arijit79/minus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/arijit79/minus/compare/v5.5.3...v5.6.0)

Updates `whoami` from 1.5.0 to 1.5.1
- [Changelog](https://github.com/ardaku/whoami/blob/v1/CHANGELOG.md)
- [Commits](https://github.com/ardaku/whoami/compare/v1.5.0...v1.5.1)

---
updated-dependencies:
- dependency-name: minus
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: whoami
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 10:55:18 -05:00
Yuya Nishihara
9c1d5d155e index: remove HRTB stuff by implementing RevWalkIndex for CompositeIndex 2024-03-11 17:24:10 +09:00
Yuya Nishihara
3d0952b316 index: implement AsCompositeIndex for CompositeIndex, not for &CompositeIndex
Just a minor code cleanup. We still need Index for &CompositeIndex because the
type is unsized, and unsized type cannot be converted to another dyn reference.
2024-03-11 17:24:10 +09:00
Yuya Nishihara
243675b793 index: turn CompositeIndex into transparent reference type
This helps to eliminate higher-ranked trait bounds from RevWalkRevset and
RevWalk combinators to be added. Since &CompositeIndex is now a real reference,
it can be passed to functions as index: &T.
2024-03-11 17:24:10 +09:00
Yuya Nishihara
c8be8c3edd index: add type alias for "dyn IndexSegment" to clarify it's 'static
This helps to migrate CompositeIndex<'_> wrapper to &CompositeIndex. If
the wrapped reference had a lifetimed field, it couldn't be represented as
a trivial reference type.
2024-03-11 17:24:10 +09:00
Yuya Nishihara
64e0be2477 revset: consolidate early-return condition of PositionsAccumulator
Since consume_to() checks the bottom position yielded from the source iterator,
it makes sense to add the same check for the cached positions.
2024-03-11 17:24:01 +09:00
Martin von Zweigbergk
93c1a8079f squash: leverage helper extracted from jj move
This patch makes `jj squash` us the helper I just extracted from `jj
move`. I had a to add a few small features to it for that.

The `test_squash_command.rs` test changed in a few cases where we do a
partial squash. After this patch, we include the rebased child in the
count of rebased descendants. That seems reasonable and consistent
with partial squash/move further than 1 generation.
2024-03-10 21:17:08 -07:00
Martin von Zweigbergk
2e3939df1c squash: fail on merge commits before failing on immutable commits
This is just a little step towards reusing the helper I just extracted
from `jj move`. I had to update `test_immutable_commits.rs` because it
would otherwise fail because of the merge rather than failing because
of the immutable commit.
2024-03-10 21:17:08 -07:00