4038 Commits

Author SHA1 Message Date
shoce
69e1e152fe colors config: crossed-out text formatting support
to allow
```
"diff removed" = { crossed-out=true }
```
2026-07-01 11:40:14 +00:00
Stephen Jennings
4c615c0715 run: Add --restore-descendants option 2026-06-29 19:47:17 +00:00
Yuya Nishihara
d9d98b4cf9 rewrite: don't rebase immutable descendants of rewritten revisions
Commands like "jj git fetch"/"import" can update immutable commits to reflect
the remote changes. When this happens, we should avoid rebasing their immutable
descendants.

I also updated the doc comment for transform_commits(), which already supports
disconnected ranges. Because find_descendants_for_rebase() excludes commits
within parent_mappings, the graph isn't always connected (without this patch).

The new changelog entry also covers the changes from 44146561 "git: look for
predecessors also in locally reachable commits".
2026-06-29 10:09:50 +00:00
Yuya Nishihara
163fb32b0b cli: move rebase_descendants() to finish_transaction() callers
While repeated rebase_descendants() calls should be noop, it seems slightly
better to do rebase_descendants() once.
2026-06-29 10:09:50 +00:00
Yuya Nishihara
44146561df git: look for predecessors also in locally reachable commits
When multiple bookmarked revisions exist in a stack, previously merged revisions
were not abandoned because they remained reachable. This patch fixes that by
rewriting merged revisions based on their change IDs and rebasing their
descendants onto the merged head.

The tricky part is that we shouldn't "rewrite" locally hidden revisions that
were remotely reachable (but no longer are). However, we still need to count
them as predecessors for a better evolution history.

There is a known issue where immutable descendants can accidentally be rebased
onto rewritten immutable parents. For example, suppose we have the history
A@origin <- B@origin and A@origin is rewritten remotely. If we fetch only
A'@origin, B@origin ends up being rebased onto A'@origin. Because remote
bookmarks do not move locally, this process creates a new, anonymous B revision.
One way to fix this would be to implement rebase_descendants() that leaves
immutable descendants untouched, while still allowing mutable descendants to be
rebased onto A'@origin.
2026-06-25 00:43:17 +00:00
Yuya Nishihara
3088d28a99 git: exclude rewritten commits from abandoned stats, print number separately
Since rewriting commits is common in jj, it doesn't make much sense to print a
detailed list of rewritten commits.

This change also helps rewrite locally reachable commits in addition to the
current abandon-unreachable rule.
2026-06-25 00:43:17 +00:00
Stephen Jennings
bf15825fe9 run: Remove unnecessarily verbose summary output
Writing the command makes the output unnecessarily long, and other jj
subcommands don't output as much detail when summarizing what they did.

In addition, the "No commits were rewritten" message is unnecessary
because the usual "Nothing changed" message is also printed.
2026-06-24 12:52:53 +00:00
Stephen Jennings
425881c360 run: Add --clean flag to wipe working copies before each job
--clean deletes each workspace's working_copy/ and state/ directories
after acquiring the lock, so every commit starts from a freshly
checked-out tree. Build artifacts from previous runs are not reused.
2026-06-24 00:26:55 +00:00
Stephen Jennings
5a9b9c3b95 run: Reuse a pool of workspaces between invocations
Previously, we created a new unique working copy for each invocation
named after the commit ID. This works but can be very slow to rebuild
the working copy and any ignored build artifacts between each
invocation.

Workspaces used for `jj run` are now named `1`, `2`, ..., `N`, where `N`
comes from either `--jobs N`, the config value `run.jobs`, or defaults
to 1.

Remove the single global lock that prevented multiple `jj run` instances
from executing concurrently. Multiple processes wait for each workspace
individually.

Workspaces persist between command invocations so build artifacts are
reused. The `tree_state` file in each is used to check out the next
revision while leaving ignored files in place.

The previous "fresh workspace" behavior will be restored in a future
commit that adds a `--clean` flag.
2026-06-24 00:26:55 +00:00
Vincent Ging Ho Yim
805a3134a7 cli: use default_value_t to accept typed values for CLI flags 2026-06-23 15:41:13 +00:00
Vincent Ging Ho Yim
f6acada8a3 cli rebase: indicate --destination as alias for --onto in help
Fix up to #8362.
2026-06-22 08:36:09 +00:00
Thomas Axelsson
64d3cea645 cli: Document templates.*_list settings in help texts
Also drops the documentation example with default config list template, as
generally it's not useful to list an example TOML block with the default values.

Fixes #9428
2026-06-21 09:34:36 +00:00
Matt Stark
760330afb9 gerrit: Add jj gerrit upload -o similar to git push -o
This allows jj to support custom options provided by the git server.
For example, chromium sometimes requires `git push -o nokeycheck`
if you intentionally uploaded a private key.
2026-06-18 23:34:42 +00:00
Austin Seipp
29b7f4a1d0 cli: float run lock acquisition upwards
Let's assume we have two concurrent run invocations on a given stack of
commits T1 and T2, started in that order:

    T1: 'sleep 10'
    T2: 'sleep 1'

T2 blocks completely until T1 finishes. There are two problems with the
current approach:

1. When T1 finishes, it removes the default `run/default` directory its
   WCs were put under; but the lock file is put under `run/default/lock`,
   which T2 is waiting to grab -- which will subsequently fail with
   `ENOENT` because the directory was removed from under it.
2. The working copy was loaded before taking the lock. Let's say T1 and
   T2 both actually modify the working copy and subsequently rewrite
   some commits. When T1 finishes and T2 starts, T2 will have loaded the
   workspace from before T1 had committed its rewrite(s), and thus has
   an old stale version of its commits; this will cause divergence for
   fairly obvious reasons.

The fixes are simple: A) put the lock file under `run/default.lock`
instead to handle this, and B) take the lock before loading the
workspace.

This also deletes some redundant comments and adds a note about the lock
file requirement.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2026-06-17 17:33:26 +00:00
Austin Seipp
81e245a023 cli: inform user when waiting on a jj run lock
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2026-06-17 17:33:26 +00:00
Stephen Jennings
4c05f09407 run: 3-way merge changes instead of replacing trees
When a command passed to `jj run` modifies the working copy, these
changes are supposed to be merged into the working copy.

However, we were simply _replacing_ the old tree with the new tree,
which gave us behavior like `--restore-descendants`. Instead, we need to
do a 3-way merge so the changes accumulate.

A future enhancement will add `jj run --restore-descendants`.
2026-06-17 00:11:41 +00:00
Benjamin Tan
60c42fd9db cli: fix typo 2026-06-15 02:08:11 +00:00
Stephen Jennings
9dde1e75d0 run: Show stdout/stderr even if command fails 2026-06-14 00:59:31 +00:00
figsoda
eef08f23cf cli: look for config files in /etc/jj
Allows users to set up system-wide config files, for e.g. multi-user setups,
which has lower precedence than per-user config files, unlike $JJ_CONFIG or
--config-file.

closes jj-vcs#7321
2026-06-13 14:01:38 +00:00
Stephen Jennings
64736e55fc run: Reveal command in CLI documentation 2026-06-13 06:04:44 +00:00
Philip Metzger
c09a1ab3a0 run: Add revsets.run to give jj run a default revset
So each command no longer requires the `--revisions` by default. This is
similar to `jj fix`'s `revsets.fix`, so maybe we should unify them at
some point.

AFAIK, hooper and arxanas have expressed interest in that.
2026-06-13 06:04:44 +00:00
Stephen Jennings
36e03052e3 run: Run commands from the same working copy subdirectory
Run each command from the same subdirectory of the working copy that `jj
run` is run from.

Adds a `--root` option to instead run from the root of the working copy
regardless of where `jj run` is executed from.
2026-06-13 06:04:44 +00:00
Philip Metzger
2b2d20c2f5 run: Add a minimal implementation of jj run
This is basically a MVP based on `fix`, caching is not implemented yet.
The core functionality is in `run_inner()` and `rewrite_commit()`.

It also exposes some initial environment variables for scripting purposes.

Stdout and stderr from the commands are buffered then output by the
parent process, matching the behavior of `jj fix`.
2026-06-13 06:04:44 +00:00
Joseph Lou
10facb1a8a bisect run: Update documentation
The description used to be referring to the deprecated `--command` flag
(it is now a positional argument). Also updated some other wording.
2026-06-12 16:37:43 +00:00
Yuya Nishihara
4211b00f9f cli: bookmark: add proper support for track/untrack by <name>@<remote> syntax
While it's a bit odd that the glob pattern and exact remote symbol arguments are
overloaded, the symbol syntax is undeniably convenient.

`RemoteBookmarkNamePattern` and `Display for StringPattern` have been removed as
they are no longer used.

Closes #9226
Closes #9426
2026-06-12 13:27:27 +00:00
Yuya Nishihara
7d16343025 cli: print uncommitted snapshot and reset-head operations
Fixes #9534
2026-06-11 14:42:38 +00:00
Yuya Nishihara
5698985957 revset: remove deprecated ui.revsets-use-glob-by-default flag 2026-06-11 14:42:30 +00:00
Josh McKinney
726c21ffc0 cli: git remote add: warn on duplicate URLs
Warn when adding a Git remote whose configured fetch URL or effective
push URL exactly matches an existing remote. This catches accidental
duplicate remotes while leaving the add operation unchanged.

The warning compares configured URL strings without applying Git URL
rewrite rules. URL equivalence is not reliable across HTTPS, SSH, .git
suffixes, redirects, and rewrite rules, so this is intentionally only an
exact-match warning.

Do not print the matching URL in the warning because remote URLs can
contain embedded credentials. The existing remote name and URL direction
provide enough context for the user to remove the new remote if it was a
mistake.

Fixes #413.
2026-06-09 14:48:46 +00:00
Yuya Nishihara
30d73a5dc9 cli: show: add support for --reversed flag
I have an alias to show diffs in chronological order. This alias can be migrated
from "jj log" to "jj show" if --reversed is supported.
2026-06-09 13:52:47 +00:00
Yuya Nishihara
93c8ea9c46 revset, templater: remove deprecated git_head() and git_refs() functions 2026-06-09 11:16:46 +00:00
Atakan Yenel
6600e00501 cli: add garbage collection for config files of deleted repos
This PR addresses issue #9362 and adds a jj config gc command 
to cleanup the config files after repos have been created 
and deleted. 

FIXES #9362
2026-06-08 15:52:27 +00:00
Martin von Zweigbergk
990efb5331 arrange: add tests for the render() function 2026-06-08 03:15:22 +00:00
Martin von Zweigbergk
400579e23a arrange: pass in function for rendering commit into render()
This helps make the `render()` function testable.
2026-06-08 03:15:22 +00:00
Martin von Zweigbergk
44882b0b07 arrange: pass ratatui Buffer instead of Frame to render()
This was recommended on Discord by @joshka at some point. It makes it
easier to test the `render()` function because it's easier to produce
a `Buffer`.
2026-06-08 03:15:22 +00:00
Yuya Nishihara
36f4f09be4 cli: create mutable working-copy commit only when needed
This will probably work better when the immutable set is defined by the current
working copy.

Closes #7751
Closes #9338
2026-06-07 03:55:41 +00:00
Yuya Nishihara
8f71ca8e99 tests: remove implicit working-copy commit creation from op diff/log tests
Also fixed the test for tag movement.
2026-06-07 03:55:41 +00:00
Yuya Nishihara
705f639e93 cli: extract resolve_immutable_expression(), replace callers of find_*()
It should be better to resolve the expression once and reuse the result.
2026-06-07 03:55:41 +00:00
ase
a2523c12e4 cli: only use mimalloc on ci validated configurations
Fixes #9606
2026-06-05 15:28:25 +00:00
Eyüp Can Akman
a8ef9b5285 git: reject remote names that are empty or contain whitespace
Use `gix::remote::name::validated()` to reject invalid git remote names
(empty strings, whitespace, and other names that git itself would reject)
at the jj-lib level before they propagate to git operations.

Fixes #9099
2026-06-04 11:31:48 +00:00
dependabot[bot]
aafd1c865d cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [gix](https://github.com/GitoxideLabs/gitoxide), [gix-ignore](https://github.com/GitoxideLabs/gitoxide), [rpassword](https://github.com/conradkleinespel/rpassword) and [toml_edit](https://github.com/toml-rs/toml).


Updates `gix` from 0.83.0 to 0.84.0
- [Release notes](https://github.com/GitoxideLabs/gitoxide/releases)
- [Changelog](https://github.com/GitoxideLabs/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GitoxideLabs/gitoxide/compare/gix-v0.83.0...gix-v0.84.0)

Updates `gix-ignore` from 0.21.0 to 0.21.1
- [Release notes](https://github.com/GitoxideLabs/gitoxide/releases)
- [Changelog](https://github.com/GitoxideLabs/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/GitoxideLabs/gitoxide/compare/gix-ignore-v0.21.0...gix-ignore-v0.21.1)

Updates `rpassword` from 7.5.3 to 7.5.4
- [Release notes](https://github.com/conradkleinespel/rpassword/releases)
- [Commits](https://github.com/conradkleinespel/rpassword/compare/v7.5.3...v7.5.4)

Updates `toml_edit` from 0.25.11+spec-1.1.0 to 0.25.12+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.25.11...v0.25.12)

---
updated-dependencies:
- dependency-name: gix
  dependency-version: 0.84.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: gix-ignore
  dependency-version: 0.21.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: rpassword
  dependency-version: 7.5.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: toml_edit
  dependency-version: 0.25.12+spec-1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-03 11:44:53 +00:00
Yuya Nishihara
ca26b6b834 merge_tools: convert snapshot root to relative path first
It's more obvious that the snapshot directory root shares the same prefix as the
temporary directory.
2026-06-02 13:11:59 +00:00
Yuya Nishihara
ee632184d8 merge_tools: remove redundant "_" prefix from TempDir 2026-06-02 13:11:59 +00:00
Jakub Stasiak
92b7af489d diff: avoid word inlining without color
Color-words diffs use formatter labels to distinguish removed and
added tokens. When color is disabled, those labels are invisible,
so inline word changes can collapse into unreadable text when
stdout is not a TTY.

Render color-words hunks as separate before and after lines
whenever the formatter cannot emit color. This keeps the default
diff format stable while making piped or redirected output
readable.

Color-words tests that rely on inline display force color output
because inlining is only triggered when color is available, ANSI
sequences are stripped before snapshotting to keep the snapshots
readable.

This does not make redirected diffs into git-format patches.
Users still need --git for patch exchange or tools that require
unified diff input.

Fixes #5894.
Related to #6972.
2026-06-01 06:15:18 +00:00
Alex Jaspersen
281e90ea0d diffedit: support "file-by-file" invocation mode
Add support for invoking diff editors (`jj diffedit`, `jj split`, etc.) once per changed file, instead of once with a temporary directory pair. This enables using per-file tools like `vimdiff` for editing.

The new `merge-tools.<tool>.edit-invocation-mode` option controls this independently from `diff-invocation-mode`.

Fixes #7760.
2026-05-29 14:31:46 +00:00
Yuya Nishihara
17a8069a08 cli: git: remove deprecated push-new-bookmarks and --allow-new option
The comment about classify_bookmark_push_action() was also removed because
--bookmark=NAME supports auto-tracking.
2026-05-29 11:50:31 +00:00
Yuya Nishihara
8746cbc676 git: remove deprecated auto-local-bookmark 2026-05-29 11:50:31 +00:00
Yuya Nishihara
cfe722f994 evolution: drop support for legacy commit predecessors traversal
This prepares for the removal of commit.predecessors.
2026-05-26 12:53:38 +00:00
Joseph Lou
d3e889b0c7 util: Add jj util backend name command
You could just `cat .jj/repo/store/type` instead, but that feels like
too much of an implementation detail.

This can be used in scripting to perform different actions based on the
backend being used. For instance, an `aliases.upload` script may check
that the backend is "git" before running `jj git push`. If more upstream
backends are added in the future, such an alias could be updated to
handle those as well. (Google has its own commit backend, so Google
users may already find benefit in this command.)
2026-05-24 14:18:58 +00:00
Yuya Nishihara
c278156373 cli: remove deprecated metaedit-related command options 2026-05-22 22:50:41 +00:00
Yuya Nishihara
057ba462cb tests: stop using deprecated describe options 2026-05-22 22:50:41 +00:00