Commit graph

10315 commits

Author SHA1 Message Date
Luke Randall
b433a54ecb cli: split: add --editor flag 2025-11-10 16:13:07 +00:00
Scott Taylor
643318086a diff_util: replace [T; 2] with Diff<T>
I think using `Diff<T>` for these makes the code more readable, since
using 2-element arrays gives a less clear meaning to the arguments.
2025-11-10 14:41:44 +00:00
Björn Kautler
9abdae9d3f docs: clarify reachable description
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-10 01:09:12 +00:00
Björn Kautler
ef34e633d9 docs: fix incorrect reference to git log command 2025-11-10 00:59:42 +00:00
Scott Taylor
da1921ead5 testutils: dump_tree: print contents of conflicted trees
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
Previously, `assert_tree_eq!` would give a confusing panic message if
one of the trees had a conflict.
2025-11-09 17:48:25 +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
Remo Senekowitsch
f49bd8ff0e cli bookmark rename: simplify warning logic
The case of `remote_ref.is_tracked() && !remote_ref.is_present()` is
unreachable, so the additional condition is unnecessary. If a tracked
and remotely absent bookmark exists, that must be a local one. In which
case, the "bookmark already exists" error case is reached first.

I added this condition in fd5accb75c.
I believe I added it in an iteration of the code where this check was
peformed after the new, renamed bookmark was already created. If that
bookmark was (absently) tracking, we'd be emitting a warning on the
bookmark we just created. After moving the warning earlier in the code,
I forgot that this check can now be simplified.
2025-11-09 13:42:51 +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
Scott Taylor
79fc20e856 merged_tree: use Merge<TreeId> instead of Merge<Tree>
Currently, creating a `MergedTree` requires reading all of its root
trees from the store. However, this is often not actually required. For
instance, if the only reason to read the trees is to call
`MergedTree::merge`, and the merge is trivial, then there was no need to
read the trees. Changing `MergedTree` to only require a `Merge<TreeId>`
instead of a `Merge<Tree>` will make it possible to avoid reading trees
unnecessarily in these cases.

One benefit of this approach is that `Commit::tree` no longer requires
reading from the store, so it can be made synchronous and infallible,
which simplifies a lot of code.
2025-11-08 14:06:58 +00:00
Scott Taylor
71b1fd82f7 merged_tree: only accept trees from root directory
Since reading subtrees now returns `Merge<Tree>` instead of
`MergedTree`, we can require that `MergedTree` is only used at the root
directory. This will make the next commit simpler since it won't need to
keep track of directories.

This does complicate `jj debug tree`, since it previously relied on
`MergedTree` to iterate over the entries, but since it's only used for
debugging purposes, I think it's fine to make the code more complicated
if it makes `MergedTree` simpler.
2025-11-08 14:06:58 +00:00
Scott Taylor
6c441ca69f merged_tree: remove names() method
This method is unused, so it doesn't seem to be worth moving to
`Merge<Tree>`.
2025-11-08 14:06:58 +00:00
Scott Taylor
486f1d8129 merged_tree: move tree reading methods to Merge<Tree>
I'm planning to make `MergedTree` contain `Merge<TreeId>` instead of
`Merge<Tree>`, and these methods would all require reading a
`Merge<Tree>`, so I think it makes more sense to have them on
`Merge<Tree>` itself. Also, if `MergedTree` contains conflict labels or
other metadata in the future, it would be better to not have to clone
them each time a subtree is accessed.
2025-11-08 14:06:58 +00:00
Ilya Grigoriev
5154a94d50 docs: update uv dependencies
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
mkdocs-material development slowed, so let's carefully try
the most recent version.
2025-11-07 17:24:27 +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
aa2b76978c release: 0.35.0
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-06 02:22:19 +00:00
Jakob Hellermann
d0ea4139a9 cli: complete all -T templates dynamically
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-05 17:16:13 +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
Joseph Lou
0585cd9c95 docs: Fix invalid toml example 2025-11-04 19:32:46 +00:00
Yuya Nishihara
96b746a73e matchers: use RegexSet to test matches of multiple glob patterns
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
The performance wouldn't matter here, but it seems better that we don't have to
deal with multiple regex patterns in match functions.

I also renamed "name" variable because it may consist of multiple path
components.
2025-11-04 13:25:20 +00:00
Yuya Nishihara
5348c753ed matchers: reorganize GlobsMatcher constructor as builder
Since non-trivial matcher objects should be constructed by FilesetExpression, we
won't need a convenient constructor function. It's easier to port Vec<Regex> to
RegexSet if the patterns Vec is owned by the builder.
2025-11-04 13:25:20 +00:00
Yuya Nishihara
f2df32b6fa matchers: extract parse_file_glob() test helper 2025-11-04 13:25:20 +00:00
Yuya Nishihara
e86cdadf0e matchers: rename FileGlobsMatcher to GlobsMatcher
I'm going to add "prefix" globs to enable globs by default #6971, and the
implementation will be quite similar to the current FileGlobsMatcher.
2025-11-04 13:25:20 +00:00
Yuya Nishihara
98f45ff294 matchers: rename test functions to be all in snake_case 2025-11-04 13:25:20 +00:00
Gabriel Goller
df1b452acf config: add hostname-based conditional config scopes
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 enables configuration to be conditionally applied based on the
hostname set in `operation.hostname`. Users can now use
`--when.hostnames = ["host-a", "host-b"]` in their config files to apply
settings only on specific machines.

Fixes: #6441
2025-11-04 09:03:29 +00:00
dependabot[bot]
7fac2b700f cargo: bump the cargo-dependencies group across 1 directory with 6 updates
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
Bumps the cargo-dependencies group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.50` | `4.5.51` |
| [clap_complete](https://github.com/clap-rs/clap) | `4.5.59` | `4.5.60` |
| [clap_complete_nushell](https://github.com/clap-rs/clap) | `4.5.9` | `4.5.10` |
| [etcetera](https://github.com/lunacookies/etcetera) | `0.10.0` | `0.11.0` |
| [ignore](https://github.com/BurntSushi/ripgrep) | `0.4.24` | `0.4.25` |
| [proptest-derive](https://github.com/proptest-rs/proptest) | `0.6.0` | `0.7.0` |



Updates `clap` from 4.5.50 to 4.5.51
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.50...clap_complete-v4.5.51)

Updates `clap_complete` from 4.5.59 to 4.5.60
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.59...clap_complete-v4.5.60)

Updates `clap_complete_nushell` from 4.5.9 to 4.5.10
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete_nushell-v4.5.9...clap_complete_nushell-v4.5.10)

Updates `etcetera` from 0.10.0 to 0.11.0
- [Release notes](https://github.com/lunacookies/etcetera/releases)
- [Commits](https://github.com/lunacookies/etcetera/compare/v0.10.0...v0.11.0)

Updates `ignore` from 0.4.24 to 0.4.25
- [Release notes](https://github.com/BurntSushi/ripgrep/releases)
- [Changelog](https://github.com/BurntSushi/ripgrep/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/ripgrep/compare/ignore-0.4.24...ignore-0.4.25)

Updates `proptest-derive` from 0.6.0 to 0.7.0
- [Release notes](https://github.com/proptest-rs/proptest/releases)
- [Changelog](https://github.com/proptest-rs/proptest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/proptest-rs/proptest/compare/proptest-derive-0.6.0...proptest-derive-0.7.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.5.51
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-version: 4.5.60
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete_nushell
  dependency-version: 4.5.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: etcetera
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: ignore
  dependency-version: 0.4.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: proptest-derive
  dependency-version: 0.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-04 00:26:20 +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
dependabot[bot]
60718d605b github: bump the github-dependencies group with 3 updates
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
Bumps the github-dependencies group with 3 updates: [taiki-e/install-action](https://github.com/taiki-e/install-action), [cachix/install-nix-action](https://github.com/cachix/install-nix-action) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `taiki-e/install-action` from 2.62.38 to 2.62.45
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](c5b1b6f479...81ee1d48d9)

Updates `cachix/install-nix-action` from 31.8.1 to 31.8.2
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Changelog](https://github.com/cachix/install-nix-action/blob/master/RELEASE.md)
- [Commits](fd24c48048...456688f15b)

Updates `github/codeql-action` from 4.31.0 to 4.31.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4e94bd11f7...0499de31b9)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.62.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: cachix/install-nix-action
  dependency-version: 31.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 18:02:28 +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
Ilya Grigoriev
e921bfaa05 diff_util: move unified diff utils to jj-lib
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-31 18:16:48 +00:00
Yuya Nishihara
53f18f3bb1 git: replace remaining users of is_special_git_remote()
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
We no longer need jj-lib functions.
2025-10-31 00:37:50 +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
Yuya Nishihara
626e5b29a6 revset: parameterize special "git" remote that is ignored by default
The default remote parameter of remote_bookmarks() will be derived from this
parameter. It doesn't make sense to exclude @git bookmarks if the backend isn't
Git. It's also nice that parsing tests don't depend on the feature flag.
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
Ilya Grigoriev
5aee657c0c colocation docs: reflow some paragraphs
There was an annoying extra line in the CLI help. I fixed up that and a
few additional paragraphs.

Fixup to c32b476
2025-10-30 18:40:29 +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
Martin von Zweigbergk
4100816201 github: ask only @martinvonz to add new contributors to team
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
I think I am the only maintainer who is able to add new contributors
to jj-vcs/contributors.
2025-10-30 03:43:12 +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
Yuya Nishihara
9d60816847 str_util: add AST type that represents compound string expressions
This type is akin to Revset/FilesetExpression. Unlike these, StringExpression
doesn't have Difference(x, y) node because Difference isn't any cheaper to
compute than Intersection.

Since string patterns are often parsed as revset symbols in CLI, there's no
native parser for the "string set expression".
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