Commit graph

94 commits

Author SHA1 Message Date
Scott Taylor
5fd1b2fd5b rewrite: add conflict labels for squashed commits
An example of squashing `ysrnknol` into `rtsqusxu`:

```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "A" (squash destination)
updated in destination
%%%%%%% diff from: vpxusssl 38d49363 "B" (parents of squashed commit)
\\\\\\\        to: ysrnknol 7a20f389 "C" (squashed commit)
-base
+squashed
>>>>>>> conflict 1 of 1 ends
```

Or with only partial changes selected:

```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "A" (squash destination)
updated in destination
%%%%%%% diff from: vpxusssl 38d49363 "B" (parents of squashed commit)
\\\\\\\        to: selected changes for squash (from ysrnknol 7a20f389 "C")
-base
+selected changes
>>>>>>> conflict 1 of 1 ends
```
2025-12-23 00:59:32 +00:00
David Higgs
223470295e cli: remove newline addition between template and content
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Commands `jj log`, `jj evolog`, and `jj op log` automatically added a
terminating newline when the expanded template did not include one in graph
mode. No-graph mode did not do this, so the expanded template could combine with
any following content (diff, op changes, etc) in confusing or problematic ways.

Instead of trying to compensate in all cases, remove the auto-fixups. Users
should confirm their custom templates still expand correctly for their needs.
2025-12-22 02:47:58 +00:00
Scott Taylor
33ad38bfed templates: add "divergent" label to log for divergent changes
It would be good to include the word "divergent" in the log when a
change is divergent, since users are often unsure what's happening when
they see a divergent change, and giving them a term to search for would
be helpful. However, I don't think it looks good to put this label next
to the change ID itself if both are the same color, since it ends up
being hard to distinguish from the change offset at a glance. Also,
putting the label next to the change ID also messes up the alignment of
fields in the log. Therefore, I think it looks better to put the
"divergent" label at the end of the line.

Since divergence and hidden commits are similar, it makes sense for both
labels to be in the same place, so I also moved the hidden label to the
end for consistency.

One downside is that the labels are less obviously connected with the
change ID itself due to them being farther apart. I think this could be
fine, since they are still visually connected by being the same color.
2025-12-20 16:55:51 +00:00
Scott Taylor
ba73442b2a conflicts: update conflict marker format
Conflict labels will generally start with lowercase change IDs, so
making all of the text lowercase makes it more consistent. I also
removed the "contents of" text, since conflict labels will already be
long enough, and this text doesn't add anything. Similarly, I removed
the "(conflict 1 of 1)" note from the Git conflict markers since Git
doesn't include this information, and including it would result in extra
long lines once we add conflict labels.
2025-12-20 04:03:57 +00:00
Scott Taylor
0dffb6f108 templates: show change offsets for divergent and hidden commits
For now, I just replaced `??` with the change offset for divergent
commits. We can add an explicit "divergent" label later.
2025-12-16 02:02:31 +00:00
Yuya Nishihara
97375fa041 revset: enable glob string matching by default
Follows up c93682f2 "revset: parameterize default string pattern kind, add
config knob".
2025-12-15 04:27:32 +00:00
Theo Buehler
cfb6509e38 tests: update cargo insta snapshots
Running "cargo insta test --workspace", results in numerous warnings:

Snapshot test passes but the existing value is in a legacy format.
Please run `cargo insta test --force-update-snapshots` to update to
a newer format.

This commit is the result of running the suggested command.
2025-12-09 18:59:34 +00:00
David Higgs
b0f2f33e1c tests: exercise squashing a non-revset file
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-06 13:11:12 +00:00
David Higgs
bfcef5d9ef tests: exercise interactively squashing no changes 2025-12-06 13:11:12 +00:00
David Higgs
4191f13edd tests: exercise squashing @ with destination 2025-12-06 13:11:12 +00:00
David Higgs
a1c9c3daff tests: demonstrate squash-moves with bookmarks 2025-11-29 13:21:58 +00:00
Steve Klabnik
5b3aa51140 docs: jj-vcs.github.io -> jj-vcs.dev
As a follow-up to #8115, this moves all references in the codebase to use the new website.

I didn't update the older CHANGELOG entries because I figured they're intended
to be immutable.
2025-11-26 00:36:39 +00:00
Yuya Nishihara
3b37ed102e tests: specify string pattern prefix, use subject(glob:_) accordingly
Deprecation warnings will be emitted for default "substring:" patterns. This
change will suppress them. Since "glob:" will be the new default, I made these
tests use "glob:" when both "exact:" and "glob:" work.

Tests for the revset filter functions aren't updated.
2025-11-24 01:39:32 +00:00
Tejas Sanap
d5355b4135 cli: jj squash warns when fileset doesn't exist 2025-11-10 22:56:32 +00:00
Martin von Zweigbergk
32aee9dbdf cli: deprecate --destination/-d in favor of --onto/-o
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
As we have discussed many times on Discord and GitHub, `--destination`
is not a great name because `--insert-before` and `--insert-after` are
also destinations. The most popular alternative seems to be
`--onto`. We already use that term in descriptions in several places,
such as in the help text for `rebase -d` where we say "The revision(s)
to rebase onto". This patch therefore renames the `--destination` flag
to `--onto`.

The short name naturally becomes `-o`. That is perhaps a little
unfortunate because it's a common short name for `--output <file>`
arguments, but we don't use that anywhere so it seems fine.

Perhaps we should also rename `--source` (used by `rebase` and `fix`)
to something else. Perhaps the most obvious name is `--descendants`,
but the short form would be `-d`, which is of course already taken by
`--destination` in the case of `rebase`. Either way, I'm leaving that
rename for later. It would be good to do it before next release if we
are going to do it, though.

Closes #7941
2025-11-08 14:56:37 +00:00
Luke Randall
9cc1ed1fcd cli: squash: add --editor flag
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-11-07 10:51:11 +00:00
Gaëtan Lehmann
b3ea95ff59 squash: fix -A -B behavior
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
and add the corresponding test. The children of the new commit were not
properly rebased on their parents.

fix: #7636
2025-10-09 15:53:46 +00:00
Yuya Nishihara
b384097caa tests: do not use "jj undo" to run multiple tests with the same setup
Since "undo" is now a high-level command, we shouldn't rely on "undo" to roll
back to a certain state.
2025-08-26 00:27:29 +00:00
Yuya Nishihara
827a87f05b tests: insert explicit snapshot after setting up test workspace
This helps capture the operation id of the snapshot.
2025-08-26 00:27:29 +00:00
Yuya Nishihara
35995514c8 tests: get current operation id without running jj
It's nice that the operation id can be captured without incrementing seed.
2025-08-26 00:27:29 +00:00
Yuya Nishihara
6e63c5d9aa templates: remove operation timestamp from default evolog template
The operation timestamp is often very close to the committer timestamp, so I
don't think it's useful in evolog. I also removed "root()" as it wouldn't be
useful either, and the root operation should have no evolved commits.
2025-08-25 05:52:37 +00:00
Remo Senekowitsch
12b3a26f3d undo: revert progressively older operations with repeated calls
New users (especially ones unfamiliar with CLI programs) intuitively
expect `jj undo` to work the same way the "undo" functionality of
typical GUI applications do. That means, running `jj undo` multiple
times should restore progressively older states of the repository
one-by-one.

Related feature request "jj undo ergonomics":
https://github.com/jj-vcs/jj/issues/3700
2025-08-24 06:56:40 +00:00
Hegui Dai
569ec5ddfe config: show IDs in draft description 2025-08-21 23:52:26 +00:00
Yuya Nishihara
a4cf4f2ae8 cli: evolog: migrate to evolution template type
This patch doesn't add builtin_evolog_redacted template because I'm not sure if
we want to collect evolution log for debugging purpose. The redacted template
can be added later if needed.
2025-08-21 13:35:21 +00:00
Gaëtan Lehmann
1e58ca2253 squash: add -A/-B/-d options
For example, with a commit tree like this one:

@  kkrvspxk (empty) (no description set)
○  lpllnppl file4
│  A file4
○  xynqvmyt file3
│  A file3
○  wkrztqwl file2
│  A file2
○  mzuowqnz file1
│  A file1
♦  zzzzzzzz root()

we can jj squash -f x:: -d m to squash xynqvmyt and all its descendant
as a new commit onto mzuowqnz.

@  youptqqn (empty) (no description set)
○  wkrztqwl file2
│  A file2
│ ○  vsonsouy file3 file4
├─╯  A file3
│    A file4
○  mzuowqnz file1
│  A file1
♦  zzzzzzzz root()

On the implementation side, I've chosen to prepare the destination
commit before hand, and keep the squash algorithm mostly unmodified.
2025-08-19 11:38:55 +00:00
Yuya Nishihara
6c8f6e9744 cli: allow "large" revsets by default
Since divergent/conflicted symbols no longer resolve to multiple revisions, it's
less scary to allow "large" revsets than before.

The config doc is removed because it's largely duplicated from the revsets doc,
and the config key will be removed.

#6016
2025-07-11 17:15:26 +00:00
Gaëtan Lehmann
a59607db25 squash: allow to squash into the sources
This way it becomes possible, when squashing multiple commits, to specify
from which commit we keep the change-id, without needing to provide
multiple --from parameters.
For example, for a set of commits from x to z, with y somewhere in the
middle, before we had to run

  jj squash --from x::y- --from y+::z -into y

to squash x::z into y. Now we can

  jj squash --from x::z -into y

Squashing into the same change as the source becomes a no-op.

On the implementation side, we just make sure the destination commit is
not in the source commits.
2025-06-29 12:54:40 +00:00
Gaëtan Lehmann
0536c4cd7a squash: allow --interactive and fileset to be used together
everything required seems to be in place, but this was explicitly forbidden
in the command line parser configuration.
2025-06-24 18:57:19 +00:00
Yuya Nishihara
b0f3c98175 cli: evolog: group graph nodes topologically
The output looks better if the graph had long parallel history. "--limit=N" is
applied after sorting for consistency with "jj log". The doc also mentions that.

Since TopoGroupedGraphIterator emits predecessors in reverse order at squash
point, we no longer need to tweak the visiting order by walk_predecessors().
2025-06-15 01:59:33 +00:00
Yuya Nishihara
6dfc9de9b4 cli: evolog: show associated operations alongside commits
The output cannot be templated as of now. Maybe we can add a template type for
Commit + Operation?

Closes #963
2025-05-27 13:28:09 +00:00
Yuya Nishihara
60f8bdda7a evolution: walk operations to build predecessors graph
This is slower than traversing commit.predecessor_ids, but allows us to show
associated operations alongside the commits. Since operations are (mostly)
traversed in chronological order, the evolution graph is also emitted in that
order.
2025-05-27 13:28:09 +00:00
Vincent Ging Ho Yim
f1765183d6 cli: use more precise wording in conflict resolution hint
We already use "conflicted commit" at the very end of the hint, so I've reused that term
here.
2025-05-22 03:49:34 +00:00
Martin von Zweigbergk
acd824269f git: write change-id header by default
We haven't had any reports of problems from people who opted in. Since
it's early in the release cycle now, let's now test it on everyone who
builds from head, so we get almost a month of testing from those
people before it's enabled by default in a released version.

This impacts lots of test cases because the change-id header is added
to the Git commit. Most are uninteresting. `test_git_fetch` now sees
some divergent changes where it used to see only divergent bookmarks,
which makes sense.
2025-05-08 23:05:38 +00:00
Gaëtan Lehmann
7073811fe0 squash: don't add trailers to an empty description
ref: #6265
2025-04-19 16:25:03 +00:00
Gaëtan Lehmann
6d240be777 squash: add trailer support 2025-04-18 16:35:16 +00:00
Yuya Nishihara
ea6a768517 tests: port test_squash_command.rs to TestWorkDir API 2025-04-03 01:43:02 +00:00
Yuya Nishihara
f2ca6b7740 tests: set up fake editor early in test_{split,squash}_command.rs
This helps avoid borrowing issue.
2025-04-03 01:43:02 +00:00
Yuya Nishihara
4bcebe678c cli: pad empty description intro/instruction lines with "JJ:"
Since 7618b52b "cli: consider 'JJ:' lines as comments also when not followed by
space", lines starting with "JJ:" (without space) are also ignored. We can
simply add "JJ:" prefix to empty intro/instruction lines.

Closes #5484
2025-04-01 02:02:02 +00:00
Robin Stocker
0456701e18 cli: Print @ and @- in status and print_updated_working_copy_stats
This helps newcomers learn/remember what @ and @- stand for.
2025-03-31 11:57:04 +00:00
Yuya Nishihara
c2f2461b5f cli: truncate list of newly conflicted commits
If there are hundreds of new conflict commits, the user wouldn't want to see all
of them.
2025-03-23 01:31:22 +00:00
Ilya Grigoriev
5eae2d92a0 tests: run insta --force-update-snapshots
This is a replacement for #5558.

Thanks to @yuja 's https://github.com/mitsuhiko/insta/pull/722, this is
now easy to generate.
2025-03-06 21:35:08 +00:00
Yuya Nishihara
7fa8420908 tests: resolve directory path to run_jj_in() relative to env_root
Suppose we'll add test_env.init_workspace(path) or something, this will probably
make sense.
2025-02-25 15:40:14 +00:00
Yuya Nishihara
804d175fd9 tests: migrate non-snapshot users of jj_cmd_ok() to run_jj_in().success()
These callers were mostly substituted mechanically.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
3193513049 tests: migrate snapshot users of jj_cmd_ok() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up formatting.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
cdcc777730 tests: migrate snapshot users of jj_cmd_success() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up minor
formatting and name errors.
2025-02-23 13:34:17 +00:00
Yuya Nishihara
b79b29c288 tests: migrate callers of jj_cmd_cli_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
d19e58f591 tests: migrate callers of jj_cmd_failure() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
f1cd3a4e53 tests: migrate some jj_cmd_success() output wrappers to run_jj_in() 2025-02-22 01:23:04 +00:00
Yuya Nishihara
48b02226f5 cli: add "Hint: " prefix to conflict hints 2025-02-19 06:52:09 +00:00
Yuya Nishihara
630036eeb0 tests: add [EOF] marker to command output when displaying
It's important to test that command output is (usually) terminated with newline,
but insta::assert_snapshot!() is lax about that.
2025-02-19 02:31:59 +00:00