Commit graph

1749 commits

Author SHA1 Message Date
Luke Randall
2e1794cbf5 cli: squash: remove -E flag and clean up code
This also removes the superfluous already_edited logic, which was
obviated by changes to the logic in #7929.
2025-11-10 16:13:07 +00:00
Luke Randall
b433a54ecb cli: split: add --editor flag 2025-11-10 16:13:07 +00:00
Martin von Zweigbergk
f7e38ab3b3 fix: print a warning when we fail to start a merge tool
Closes #7971
2025-11-09 16:20:26 +00:00
Martin von Zweigbergk
60d4f750e3 fix: test behavior when non-existent tool binary is configured
We don't currently even print a warning when we fail to run the tool
binary.
2025-11-09 16:20:26 +00:00
Martin von Zweigbergk
29ed68d74a fix: print a warning when fix tool exits with error 2025-11-09 16:20:26 +00:00
Martin von Zweigbergk
3dc99c88f1 test_environment: let callers add additional paths to normalize 2025-11-09 16:20:26 +00:00
Martin von Zweigbergk
9112b5e666 tests_environment: inline free normalize_output()
I don't see any reason for `TestEnvironent::normalize_output()` to
just delegate to a free `normalize_output()`. By inlining it, we make
it easier to make the normalization to depend on more state.
2025-11-09 16:20:26 +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
Scott Taylor
5aa71d59a9 lib: replace MergedTreeId with MergedTree and Merge<TreeId>
After the previous commit, `MergedTree` and `MergedTreeId` are almost
identical, with the only difference being that `MergedTree` is attached
to a `Store` instance. `MergedTreeId` is also equivalent to
`Merge<TreeId>`, since it is just a wrapper around it.

In the future, `MergedTree` might contain additional metadata like
conflict labels. Therefore, I replaced `MergedTreeId` with `MergedTree`
wherever I think it would be required to pass this additional metadata,
or where the additional methods provided by `MergedTree` would be
useful. In any remaining places, I replaced it with `Merge<TreeId>`.

I also renamed some of the `tree_id()` methods to `tree_ids()` for
consistency, since now they return a merge of individual tree IDs
instead of a single "merged tree ID". Similarly, `MergedTree` no longer
has an `id()` method, since tree IDs won't fully identify a `MergedTree`
once it contains additional metadata.
2025-11-08 14:06:58 +00:00
Martin von Zweigbergk
513d50de92 cli: if bookmark list includes conflicts, hint how to resolve them
When `jj status` reports conflicted bookmarks, it suggests running `jj
bookmark list` for details and `jj bookmark set` to resolve the
conflict. However, it's easy to just read the first half of the hint
and run `jj bookmark list` and then not know what to do. Let's remind
the user of the hint in the `jj bookmark list` output if there are
conflicted bookmarks. It should also be useful for users who run `jj
bookmark list` out of habit (not directly because `jj status`
suggested it).
2025-11-07 14:42:45 +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
Remo Senekowitsch
fd5accb75c cli bookmark rename: preserve tracking state
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
Now that bookmarks can be marked as tracked without a remote one
necessarily being present, we can preserve the tracking state of a
renamed bookmark.

An existing hint tells users to `jj git push --bookmark {new_bookmark}`
in order to rename the bookmark on the remote. That hint actually didn't
work before, because the `--allow-new` flag was required. Now that
tracked state is preserved, the existing hint becomes correct without
the `--allow-new` flag.
2025-11-06 07:39:57 +00:00
Scott Taylor
f08e50a21f conflicts: add "diff-experimental" conflict marker style
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
#7917
2025-11-05 00:00:58 +00:00
Martin von Zweigbergk
e5502cd465 cargo: upgrade assert_cmd to 2.1.1
Dependabot couldn't do this because some methods became deprecated.
2025-11-03 21:10:26 +00:00
Martin von Zweigbergk
b409aa3189 colocation: rename from "colocated repo" to "colocated workspace"
Colocation is about sharing the working copy between jj and git. It's
less important where the repo is stored. I therefore think we should
not call it "colocated repo". I considered renaming it to "colocated
working copy" but that sounded awkward in many places because we often
talk about the whole workspace (repo + working copy), so "In colocated
workspaces with a very large number of branches or other refs" sounds
better than "In colocated working copies with a very large number of
branches or other refs".

Once we support colocate workspaces in non-main Git worktrees, I think
this rename will be even more relevant because then all those
workspaces share the same repo but only some of them may be colocated.
2025-11-03 16:53:26 +00:00
Remo Senekowitsch
3899e178a0 cli undo: warn about undoing push operations
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
Undoing a push operation does not undo the effects on the remote.
Bookmarks on the remote will stay in place, but the local repository
will forget about their state. If the bookmarks are subsequently
moved and pushed, that later push will fail, since the bookmarks have
"unexpectedly" moved on the remote. Therefore, add a warning telling
users to run `jj redo` to avoid these complications.
2025-11-02 16:13:00 +00:00
David Higgs
4140f9499c tests: exercise more bisect behaviors
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-01 23:17:31 +00:00
Yuya Nishihara
d6b5530513 revset: do not ignore "git" remote if user pattern is specified
Since we can now express the default pattern as `remote=~exact:"git"`, we can
unblock queries matching the "git" remote.
2025-10-31 00:37:50 +00:00
Martin von Zweigbergk
e96af181df cli: document that jj git import/export are not needed when colocated
Closes #7910
2025-10-30 20:21:05 +00:00
Peter Schilling
5597ea2b33 docs: use long-form flag names in command documentation
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
in clap, the visible_aliases, e.g. '[aliases: --after]' are shown at 
the very end, which makes it confusing if you're reading from top to
bottom.

aliases are currently omitted entirely from the man pages, making it
confusing to see undocumented aliases being used.
2025-10-30 16:28:31 +00:00
Ilya Grigoriev
c32b476645 docs: fix and improve colocation docs
Follows up on 7c0328f

Fixes #7776
2025-10-30 01:30:11 +00:00
Yuya Nishihara
f7256f611c revset: parse string patterns into StringExpression
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
A typical use case is to query bookmarked revisions ignoring auto-generated
bookmarks. `bookmarks() ~ bookmarks(x)` doesn't work because a revision may have
multiple bookmarks. It's also nice that we can document the default of
`remote_bookmarks()` as `remote_bookmarks(remote=~exact:"git")`.

Closes #7665
2025-10-29 23:59:58 +00:00
David Higgs
821240b579 tests: exercise edit of current change
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-10-29 13:15:23 +00:00
David Higgs
88fd87b243 tests: exercise --quiet for undo, redo, duplicate 2025-10-29 13:15:23 +00:00
David Higgs
f524ba436a tests: exercise status with conflicting bookmarks 2025-10-29 13:15:23 +00:00
Martin von Zweigbergk
e8a7f1824d cargo: bump gix to 0.74.1
We need to do this manually (not Dependabot) because a method became
deprecated, so we need to migrate off of it to please CI.
2025-10-28 05:54:49 +00:00
Martin von Zweigbergk
15b0225547 tests: test attempt to create identical commits
We currently don't allow you to create two identical commits. It
results in an internal error. I think we need to allow it. Let's start
by testing the current behavior.

I created these as CLI tests because I want to make sure that `evolog`
and `op diff` get tested, including rendering.
2025-10-27 16:35:47 +00:00
Martin von Zweigbergk
284fadda3a tests: allow overriding $JJ_TIMESTAMP and $JJ_RANDOMNESS_SEED in tests
I think if a particular test sets e.g. $JJ_TIMESTAMP, they would
expect it to get used by `run_jj()` but we currently overwrite a few
variables in that method. This patch makes it so we respect all
environment added to the test environment.

I'm going to use this for a test case that attempts to create
identical commits.
2025-10-27 16:35:47 +00:00
Cole Helbling
d1d8048538 metaedit: replace --update-committer-timestamp with --force-rewrite
Some checks failed
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Just moments ago, I ran into a case where I wanted to change both the
author and committer of a change. I knew about the new `jj metaedit`
command, but until now that only gave me the ability to update the
author of my change, so the committer would remain the same. My only
other option was to reach for `jj desc ... --reset-author`, which has
a deprecation warning:

    Warning: `jj describe --reset-author` is deprecated; use `jj metaedit --update-author` instead

In spite of that warning, this had the desired effect: both the author
and committer were updated.

So I figured I'd help `metaedit` grow these flags so it can be a _true_
replacement for `jj desc --reset-author`.

---

The above all happened before I was kindly informed in Discord
(https://discord.com/channels/968932220549103686/1431315533164314674)
that `jj metaedit --update-committer-timestamp` should do what I was
hoping for, which I had initially disregarded and never tried because
the help text originally said:

    This updates the committer date to now, without modifying the committer.

However, after trying it out, I noticed it actually _did_ modify the
committer.

So, I set out to improve the situation by renaming the flag (so it's
not partially-wrong: it does update the committer timestamp, as well as
everything else about the committer) and improving the help text in the
various flags.

---

In no particular order, thanks to:

* obtuse, for informing me that the `--update-committer-timestamp`
flag does what I wanted in the first place
* gaetan, for pointing out that my way of thinking was not quite meshing
with how jj does things (every modification will update the committer)
* Martin, for the new flag name
2025-10-25 22:31:16 +00:00
David Higgs
0034daa9ac describe: ensure --stdin messages get trailing newlines
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-10-24 12:05:27 +00:00
David Higgs
708baa13de tests: exercise describe revset matching no commits
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-10-24 01:13:04 +00:00
David Higgs
902e9e4541 tests: exercise metaedit more with empty author/email 2025-10-24 01:13:04 +00:00
David Higgs
60d8cab25a tests: exercise metaedit --quiet 2025-10-24 01:13:04 +00:00
David Higgs
f2d27dd538 tests: exercise hidden metaedit -r option 2025-10-24 01:13:04 +00:00
David Higgs
8d06c6fcb3 tests: exercise metaedit revset matching no commits 2025-10-24 01:13:04 +00:00
Yuya Nishihara
3d43b556c3 cli: git colocation: fix check for non-main workspace
Also removed period from the error message per convention.

Fixes #7812
2025-10-23 01:50:55 +00:00
Yuya Nishihara
3a10ca3824 cli: git colocation: sort subcommands lexicographically 2025-10-23 01:50:55 +00:00
Martin von Zweigbergk
b734cd8fa0 cli: test that jj log --ignore-immutable still renders immutable commits
I had missed that `jj log` is supposed to render commits as immutable
even when `--ignore-immutable` is passed. Thanks to @yuja for pointing
this out.
2025-10-22 15:12:14 +00:00
Yuya Nishihara
34b8191c9f cli: tests: let TestEnvironment store extra env vars in OsString
We don't need to support variables in arbitrary encoding, but it's simpler to
just accept any OsString inputs.
2025-10-22 14:46:24 +00:00
Yuya Nishihara
3523e753d5 cli: tests: remove unneeded unicode conversion from TestEnvironment 2025-10-22 14:46:24 +00:00
Angel Ezquerra
3c98f9a7d3 git: add git colocation enable | disable | status commands (fixes #4624)
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
This new command lets you turn a non colocated git repo into a colocated repo or vice-versa (by using the `jj git colocation enable` and `jj git colocation disable` commands respectively).
These commands simply implement the instructions found in https://github.com/jj-vcs/jj/blob/main/docs/git-compatibility.md#converting-a-repo-into-a-co-located-repo

You can also call `jj git colocation status` to show the current colocation status and `jj colocation` to show a help message (with the list of sub-commands).
2025-10-22 06:39:23 +00:00
Daniel Luz
b77bb24114 cli: restore: provide modified file completion for --changes-in/-c
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-10-21 21:22:00 +00:00
Martin von Zweigbergk
3a511becd6 cargo: bump ignore crate to 0.4.24
This includes the fix for
https://github.com/BurntSushi/ripgrep/issues/3127. The fix let us
optionally allow unclosed character classes in .gitignore files. It is
allowed by default when using the `GitignoreBuilder` (as we do), so we
get the fix without code changes.
2025-10-20 17:20:14 +00:00
David Higgs
2c3b7a3240 tests: prevent cli tests from failing when generating code coverage
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-10-20 13:00:50 +00:00
Scott Taylor
141832414a backend: remove MergedTreeId::Legacy variant
I'm planning to try to add conflict labels to `MergedTree` and
`MergedTreeId`, and it will be easier to add them if both are structs
with similar methods. Since we don't support reading/writing legacy
conflicts anymore (as far as I'm aware), I think it should be safe to
delete the `MergedTreeId::Legacy` variant now.
2025-10-19 13:14:27 +00:00
Owen Brooks
f88b0d8093 cli: git clone: add --branch option
When cloning with the branch option:
- Only the specified branch will be fetched
- The trunk alias is only set if the specified branch happens to be the default branch
- The clone fails if the branch does not exist in the remote
2025-10-19 05:14:11 +00:00
Yuya Nishihara
ba48317236 templater: add commit.local/remote_tags() methods for completeness
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-10-16 15:44:50 +00:00
Yuya Nishihara
0fb99c12cc templater: include remote tags in "tags" output
Since we can now update tags internally, local and remote tags may be out of
sync in non-colocated Git repositories. "tags" template should indicate that.
2025-10-16 15:44:50 +00:00
Yuya Nishihara
75041a2953 cli: add completion helper for existing tag names
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-10-16 03:03:38 +00:00
Yuya Nishihara
1f30c337c7 cli: add tag delete commands 2025-10-16 03:03:38 +00:00