Commit Graph

428 Commits

Author SHA1 Message Date
Adrian Freund
6ee9eb254b gerrit: add more push options
Allows passing multiple `hashtag`s adds `message`, `edit` and `merged`
options.  We are still missing `base` (should that allow passing revset
descriptions or only git commit hashes? Would have to convert),
`push-justification` (documentation says it's Google internal) and
`create-cod-token` (undocumented, Google internal option. Listed in
gerrit source code).
2026-04-24 18:16:43 +00:00
Jun Mukai
a97ce9af26 cli: file-search: Support string pattern syntax for --pattern
The `--pattern` flag now supports `kind:pattern` syntax.
The `kind` part is optional, and the pattern is treated
as regex when omitted.

Related to #7940
2026-04-22 15:43:43 +00:00
Joseph Lou
17557cd0c7 split: Update description of --message flag
It was unclear (from the short help) which revision would get the given
description. Also I find it easier to think in terms of what was
selected rather than "first commit" and "second commit".
2026-04-19 20:37:35 +00:00
rayaq
fdf9f5561b cli: support line range based file fixing for 'jj fix'.
Updated the CLI to support line range based file fixing.

* We added `line_range_arg` and `run_tool_if_zero_line_ranges` to `ToolConfig` so users can configure how changed line ranges are passed to tools and explicitly specify whether a tool should run when there are zero modified lines.
* We introduced the `--all-lines` argument to allow users to fall back to the previous behavior of formatting the entire file when `line_range_arg` is specified.
* We use a new `compute_regions_to_format` function to calculate the changed line ranges dynamically before applying each individual formatter tool in the sequence.
* Because a formatter tool might add or remove lines, shifting the line numbers for subsequent tools, this determines the exact target ranges by diffing the static base file content against the intermediate output of the previous tool.
* To validate this logic, we extended the `fake-formatter` test fixture with a `--line-ranges` argument to restrict execution to specific lines. We also introduced a `--split-even-length-lines` flag to mimic realistic formatters that expand line counts, proving our dynamic range recalculation properly shifts lines in complete end-to-end tests.
2026-04-10 19:52:19 +00:00
Sebastian Barfurth
90cf756e6e cli: add global option to not commit transaction
This patch adds a global `--no-integrate-operation` flag that prevents
integration/publishing of most operations, including the ones created by
`snapshot_working_copy()` and `finish_transaction()`. The operations
are still created as usual.

We provide `jj op integrate` to manually reintegrate operations created by
commands with this flag enabled.

Closes #2562

Co-authored-by: Martin von Zweigbergk <martinvonz@google.com>
2026-04-02 18:36:15 +00:00
Gabriel Goller
fae9b2b2cf docs: document revset-based tag filtering as alternative to git tag --contains
Add documentation showing how `jj tag list -r` with revset expressions
can be used to filter tags, replacing the need for dedicated flags like
`git tag --contains` or `git tag --merged`. For example,
`jj tag list -r 'REV::'` lists tags whose targets descend from REV.

Tag operations were missing entirely from the Git command comparison
table, so this also adds entries for listing, creating, and deleting
tags alongside the filtering equivalents. The `jj tag list` help text
and the revsets doc both gain examples demonstrating these patterns.
2026-04-01 12:56:48 +00:00
Shnatu
b89f5ff2d6 cli: op: elide non-salient revisions in operation diffs
This change introduces elision of "non-salient" revisions in `jj op show`,
`jj op diff`, and `jj op log -p`. This helps keep the output focused on
meaningful changes (like mutable commits) while summarizing less relevant
changes (like large sets of immutable revisions being added or removed).

A new configuration setting `revsets.op-diff-changes-in` defines which revisions
should be shown. It defaults to `mutable() | immutable_heads()`.

A new `--show-changes-in` flag is added to these commands to allow overriding
the default elision behavior for a single invocation (e.g., `--show-changes-in=all()`).

Summary of changes:
- Added `revsets.op-diff-changes-in` config with default `mutable() | immutable_heads()`.
- Implemented filtering and elision logic in `compute_operation_commits_diff`.
- Updated `op show`, `op diff`, and `op log -p` to honor the new elision behavior.
- Added elision summaries to the output (e.g., "Elided X newly removed revisions").
- Updated documentation in `docs/config.md`.
- Added comprehensive integration tests in `cli/tests/test_operations.rs`.
2026-03-25 18:09:36 +00:00
Remo Senekowitsch
ac7a867191 cli: consistently use singular in flag names
Having a mix of flags in the singular and plural form is confusing.
In some cases, e.g. `gerrit upload --reviewer`, only a single value is
accepted per flag invocation. To supply multiple values, the flag has
to be repeated. In such cases, it makes more sense to use the singular
form. In other cases, e.g. `jj log --revision(s)`, a single flag
invocation may be provided with multiple revisions (in the form of a
revset). There, using the plural form would also make sense. But, for
consistency, the singular is used in all cases.
2026-03-18 22:26:24 +00:00
Rob Pilling
5420bb0526 docs: fix interdiff code snippet documentation
a very minor misplaced backtick
2026-03-13 21:19:50 +00:00
Ilya Grigoriev
978f9afa4a insta: update snapshot so that recent insta versions don't complain
Somebody probably used an older insta version at some point after we
last fixed it up (if it's you, no worries, no harm done!)
2026-03-11 23:49:05 +00:00
Joseph Lou
8f2884a228 arrange: Accept positional revsets (fixes #9051) 2026-03-09 13:08:58 +00:00
Martin von Zweigbergk
b429552eae cli revert: revert "revert: allow revisions as positional argument"
This reverts commit 4dc6323bfd.

There's talk about maybe making the command accept paths, so let's
revert this at least for now so it's not part of the next
release. That way we have more time to think about it.
2026-03-03 21:41:47 +00:00
Richard Smith
e67aa6280e cli: make jj git fetch documentation clearer
Document the default behavior, when `--remote` is not specified, in the
main command documentation, alongside the documentation for the case
where `--tag` and `--branch` are not specified. Don't put it in the
documentation for the `--remote` flag, since it's not documentation
about the behavior of that flag.
2026-03-03 01:28:15 +00:00
Yuya Nishihara
4b0415ed83 cli: drop support for deprecated "op undo" command and flags 2026-03-01 08:06:20 +00:00
George Christou
70f07cee7c cli: bookmark rename: add --overwrite-existing flag 2026-02-28 12:40:59 +00:00
William Phetsinorath
8872839aa7 cli: add support for push options
Signed-off-by: William Phetsinorath <william.phetsinorath@shikanime.studio>
Change-Id: I05c31fe87ba4d252f49a60c63412518f6a6a6964
2026-02-27 08:28:23 +00:00
Scott Taylor
f1c7d8402f cli: remove example from bookmark move help text
Now that this can be done with `jj bookmark advance --to @-`, I don't
think it makes sense to include this as an example anymore.
2026-02-25 01:40:17 +00:00
Martin von Zweigbergk
bfee2aeaf3 arrange: unhide command
Now that the command support reordering and abandoning commits, I
think it's already sufficient to make it useful, so let's unhide it.

Closes #1531
2026-02-24 16:46:41 +00:00
Anton Älgmyr
1d18429783 bookmarks: Add jj tug inspired advance command
A common recommendation for new users is for them to add a `jj tug`
alias. This change makes that alias unnecessary by adding a native
version.

The command has customization points `revsets.advance-default-to`
and `revset-aliases.closest_bookmarks(to)` to adapt to different workflows.

The default target is `@` for parity with other bookmark commands.

Possible useful revsets to use can be found in
https://github.com/jj-vcs/jj/discussions/5568#discussioncomment-12674748.

Co-authored-by: Scott Taylor <scott11x8@gmail.com>
2026-02-23 12:33:11 +00:00
Matt Stark
6b1cda418a gerrit: Create default revisions for jj gerrit upload 2026-02-22 23:38:02 +00:00
Matt Stark
bbe9e9d90e gerrit: Implement jj gerrit upload options.
See https://gerrit-review.googlesource.com/Documentation/user-upload.html.

Note that although some options only show how to use the %suffix in the
documentation, I have tested and they also support the `-o` flag on
push.
2026-02-19 00:11:54 +00:00
Ilya Grigoriev
3a9e56d06b tests: run cargo insta test --force-update-snapshots
Note that you might get different result if you use cargo-insta <1.63.3
2026-02-17 17:43:54 +00:00
Joseph Lou
a5783bcf86 cli: Add jj util snapshot command
This essentially does the same thing as `jj debug snapshot`, but is
actually officially documented and thus "supported". We've added it to
the `util` subcommand because that seems more intuitive for the end
user, despite other `util` commands not usually needing the repo at all.
2026-02-14 15:33:34 +00:00
Theodore Dubois
7f1b6a33e2 rebase: add --simplify-parents flag to jj rebase
Fixes: #7711
2026-02-06 23:19:49 +00:00
Martin von Zweigbergk
be437286f4 revert: make revision to revert required
It's currently not a syntax error to not pass any revision
arguments. It results in "No revisions to revert." instead. This patch
makes it an error, which means clap will help us give the user a
better error message.
2026-02-06 15:50:38 +00:00
Martin von Zweigbergk
5ae0bc2204 revert: allow revisions as positional argument
I don't see a reason not to allow revisions as positional arguments
for `jj revert`. I don't think we'll ever want to pass path arguments
to the command.

Unlike the other commands that accept revisions as positional or named
arguments, I didn't make the named one hidden here since it's already
been visible for a long time.
2026-02-06 15:50:38 +00:00
Steve Klabnik
5a62731348 docs: mention that jj fix requires determinism
Fixes the documentation part of #7881.
2026-02-04 17:14:54 +00:00
Martin von Zweigbergk
3fdd025688 status: in help text, add pointer to jj diff -s -r
It seems somewhat common that users want the `jj diff -s` output from
`jj show` for another revision, so let's add a pointer to it.
2026-02-04 00:24:11 +00:00
Yuya Nishihara
9bfc8480ff cli: git fetch: disable default when --branch or --tag is specified
This behavior is similar to "jj git push". If we add "jj git push --tag" option,
it would disable the default revset.

No changelog entry is added because "jj git fetch --tag" isn't released yet.
It's also experimental.
2026-02-03 00:23:40 +00:00
Jonas Helgemo
2f3e21ebee docs: add --author flag usage examples for the metaedit command
- Added example command showing --author flag usage to metaedit.rs

The docs show examples for other similar commands, but not for the
author command. Since the format is not obvious an example is helpful.
2026-01-26 17:16:31 +00:00
Steve Klabnik
6302b8b9ed cli: fix --git-repo being ignored when git.colocate config is true
When `git.colocate` config is true (the default), the `--git-repo` flag
for `jj git init` was silently ignored. This happened because the
colocate logic was checked before the --git-repo logic:

    let colocate = if command.settings().get_bool("git.colocate")? {
        !args.no_colocate  // true unless --no-colocate passed
    } else {
        args.colocate
    };

Then in `do_init()`:

    let init_mode = if colocate {
        // takes this branch, ignoring --git-repo!
    } else if let Some(path_str) = git_repo {
        // --git-repo handling never reached
    }

This meant `--git-repo` was simply ignored unless `--no-colocate` was also
passed.

This is a regression from when colocation became the default. Before
that change, `--git-repo` worked without any additional flags because
`colocate` defaulted to false. The fix preserves that original behavior
by checking for `--git-repo` first and setting `colocate = false` when
it's provided, allowing the --git-repo code path to be reached.
2026-01-23 20:00:30 +00:00
Paul Smith
c64d42eecd workspace add: add -m/--message flag for setting commit description
This change adds the ability to provide a description for the commit
when a workspace is added.

Example:

```
$ jj workspace add -m "wip bugfix" --name bugfix ../bugfix
Created workspace in "../bugfix"
Working copy  (@) now at: xmskztnv 564c419d (empty) wip bugfix
Parent commit (@-)      : zzzzzzzz 00000000 (empty) (no description set)
```

Currently, when a workspace is added, the new (empty) commit that is
created has no description set.

This change to `workspace add` mirrors the option to the `new` command,
which can take zero or more `-m/--message` flags for setting the
description for a new commit. The same logic for creating the new commit
for a workspace applies in terms of parent revisions, so this change
brings `new` and `workspace add` closer together in terms of CLI
affordances.

Similary to `new`, this change permits multiple message flags to be
supplied on the CLI. It also retains the behavior of not otherwise
creating a description of just trailers if no message flag were supplied
but trailers were set.
2026-01-22 23:10:55 +00:00
Pavan Kumar Sunkara
69d808fe0a workspaces: Allow retrieving the path of another workspace
This allows `jj workspace root` command to take an optional workspace
arg to print the root directory of that workspace, while defaulting to
the current workspace.

We allow this by creating a new `workspace_store` which has a separate
entry for each workspace containing its name and root directory. This
store is created during initiation of the repo and is maintained
whenever `add`, `forget` & `rename` workspace subcommands are executed.

CAUTION: Moving a workspace path will not sync the path stored in the
workspace store.

CAUTION: Specifying `jj workspace root` with a workspace created before
this will result in an error.
2026-01-21 21:04:39 +00:00
Steve Klabnik
916f9b1f6d cli: clarify difference between bookmark set and bookmark move
Update the help text to (hopefully) make the distinction clearer, and show the relationship between these two commands.

Fixes #8014
2026-01-20 23:23:52 +00:00
Martin von Zweigbergk
1f02aaff58 cli: add jj op integrate command for adding operation to op log
When `.jj/working_copy/checkout` refers to an operation that's not in
the op heads, there can be a few different cases. It's typically
simply behind or ahead, but it can also be a sibling. Until we
implement `--no-commit-transaction`, it would indicate a bug if that
happens. However, it does happen sometimes (rarely) at Google where we
can fail to flush the update of the op heads to the server for some
reason, but since we optimistically assume that it will succeed, we
update the working copy to refer to the operation before we have
flushed the op-head update. When in this state, we currently print an
error saying that the repo operation is a sibling of the working
copy's operation, but we don't provide a way of fixing it. This patch
provides a command for fixing this state. It will also be useful once
we have `--no-commit-transaction` (which will presumably print the
un-integrated operation id).

We currently call the process of adding an operation to the operation
heads "publish" in the code. I still went with "integrate" here
because I think it's clearer. If we go with "integrate", we can rename
the internal uses of "publish" to match in a follow-up. Other
reasonable verbs include "record" and "accept". Or we can of course go
with "publish".
2026-01-16 05:50:56 +00:00
Yuya Nishihara
d71026acad cli: tag list: port -rREVSETS filter from "bookmark list"
Closes #7930
2026-01-15 01:32:35 +00:00
Yuya Nishihara
8eae34d889 cli: tag list: include remote tags if --all-remotes is specified
This will be needed in order to write CLI tests of tags fetched to @<remote>
namespace. --remote and --tracked are hidden for now because they are useless
without remote tags support. --all-remotes is used as a flag to show both local
and @git remote tags. No changelog entry is added because this feature is
useless except for debugging or testing.
2026-01-14 00:06:14 +00:00
Matt Stark
fcf1da9936 config: Implement secure-config design doc.
See docs/design/secure-config.md for many more details.

Fixes #3303
Fixes #1595
2026-01-12 01:33:24 +00:00
Remo Senekowitsch
c4e0b4176e cli git push: allow pushing explicitly named bookmarks
By explicitly naming the bookmark to push, users already express their
intent to push that particular bookmark. Requiring them to express
that intent a second time by manually marking the bookmark as tracked
is therefore unnecessary.

There is an exception if the bookmark is already tracked with some
remote. In that case, the user may have forgotten to specify --remote
and creating the bookmark on a different remote may be a mistake.

closes #8387
2026-01-10 05:38:29 +00:00
Vincent Ging Ho Yim
339f57a81c cli parallelize: add -r option
This brings `jj parallelize` in line with other commands such as `jj new` and `jj
duplicate` that take a `-r` option in addition to the positional argument.
2026-01-08 10:15:43 +00:00
Vincent Ging Ho Yim
dfc012bd3f cli: rename {GitCloneArgs,GitFetchArgs}::branch to ::branches
For consistency with other `Option<Vec<String>>` fields in CLI command structs.
2026-01-08 10:10:57 +00:00
Yuya Nishihara
67253467f5 docs: say "tracked remote bookmarks" in command help
This matches the terminology described in the bookmarks documentation. A local
bookmark tracks remote bookmarks of the same name.
2026-01-06 01:03:57 +00:00
Yuya Nishihara
50b469109a cli: tag list: add --sort flag and config knob
This isn't exactly the same as what the reporter proposed in #8030, but it
should usually work since versions are roughly assigned in chronological
order. We can add --sort=name-as-version later if needed.

This patch also adds missed drop(formatter).

Closes #8030
2026-01-05 00:08:02 +00:00
Carlos Knippschild
09c5118296 docs: add missing run in bisect command line example 2025-12-31 23:32:43 +00:00
Ori Avtalion
d31b04904f docs: Mention -o flag instead of -d 2025-12-30 19:09:34 +00:00
Bryce Berger
b6cc5c0e15 metaedit: fix timestamp in help text
rfc2822, and by extension chrono's parser for rfc2822, only supports a
limited number of timezones (4.3, "Obsolete Date and Time"). JST is not
one of the enumerated zones.

Current fix is to just use a supported time zone in the example. It's
still possible to use a non-enumerated timezone with a human-readable
format by giving the timezone offset directly (`-0800` for PST).

fixes #8421
2025-12-28 19:10:01 +00:00
Martin von Zweigbergk
4dd845db2e cli: indicate -d as alias for -o in help
We have had two users at Google in the last few days how have wondered
why there's no documentation for the `-d` flags. Of course, the answer
is that they're deprecated, but given how long they have been
available, many users are already use them frequently. Perhaps they
then look at `jj rebase --help` to figure out what `-d` really means
and how it's different from `-A` or `-B`. It's the confusing that they
are not mentioned at all.
2025-12-24 20:30:06 +00:00
Ilya Grigoriev
b2792e190b cli config list docs: explain config key format in templates
This also means that this field should not become a `List<String>`,
though it would make sense to create a new type for it (which could be
converted into `List<String>` in two different ways, with or without
quoting).
2025-12-23 03:27:58 +00:00
Vincent Ging Ho Yim
e9b280148e cli commit: wrap each flag in backticks in doc comment 2025-12-22 08:30:56 +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