Commit graph

303 commits

Author SHA1 Message Date
Ivan Petkov
75fa7de001 cli: git fetch: fall back to remote fetch refspecs when -b not specified
This changes the behavior of git fetch to respect the fetch refspecs
configured on the remote. This is handy for projects which use
customized fetch refspecs (e.g. only fetch certain patterns, but not all
branches) but without having to remember and repeat all the patterns by
hand on the CLI

Fixes #5323
2025-08-25 15:55:18 +00:00
Remo Senekowitsch
32020573b8 undo: deprecate the --what flag
Relevant discussion:
https://github.com/jj-vcs/jj/pull/7277#discussion_r2291421321
2025-08-24 07:14:01 +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
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
George Christou
d592653003 git fetch: add --tracked flag
Add `--tracked` flag to `jj git fetch` that fetches only tracked bookmarks
from the specified remote(s). This is symmetrical with the existing `jj git
push --tracked` functionality and is useful in large repositories where
fetching all bookmarks is slow, and manually specifying each tracked bookmark
is cumbersome.

Conflicts with `--branch` to avoid confusion. When no tracked bookmarks are
found for a remote, a warning is displayed and the remote is skipped.

Resolves #7209
2025-08-20 10:49:03 +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
Remo Senekowitsch
92ad813085 undo: deprecate the operation argument
`jj undo` is planned to become a higher-level command that progressively
undoes more operations when executed repeatedly (in a strict order).
This will be separate from the lower-level semantics of `jj op revert`,
which reverts arbitrary operations on top of the current one. The
semantics of the new, high-level `jj undo` won't make sense when
combined with specifying a specific operation to undo. Thus, start the
lengthy deprecation period right now.

Related feature request "jj undo ergonomics":
https://github.com/jj-vcs/jj/issues/3700
2025-08-18 13:58:22 +00:00
Ivan Petkov
3cb62c1e51 cli: fix fetching all tags during jj git clone
By default, `git clone` will fetch all tags (same as `git clone
--tags`), but since we perform a clone by creating a remote first then
fetching it, we have to be a little smarter and keep track of when we're
doing a clone so that we ensure all tags are fetched.

`git clone --no-tags` will skip fetching tags at all, and so this is
also the now the behavior of `jj git clone --fetch-tags none`

Closes #4682
2025-08-17 15:48:36 +00:00
George Christou
e3b69cbfb4 cli: op show: add template support
Add `-T/--template` flag to `jj op show` to allow custom formatting of
output, matching the functionality available in `jj op log`.

Also add `--no-patch` flag to suppress the diff.

`templates.op_log` remains available as a config setting, used as a fallback
when `-T/--template` is not specified.

Resolves #6980
2025-08-17 13:16:55 +00:00
Yuya Nishihara
69115282ff cli: fold help comments of "jj undo"
We no longer have a reason to add separate help text to Command::Undo.
2025-08-16 06:21:25 +00:00
Remo Senekowitsch
36ee36ce78 op: undo: rename to revert
This paves the way for the semantics of `jj undo` and `jj op revert` to
evolve independently. `jj op revert` is going to stay the low-level
command to apply the inverse of any operation. The new name is
consistent with `jj revert`, which applies the inverse of a commit.

`jj undo` on the other hand is planned to become a higher-level command,
which is more similar to, say, Ctrl+Z in typical GUI applications.
Running `jj undo` repeatedly will revert progressively older operations,
allowing the user to walk backwards in time. At the same time, `jj undo`
will lose the abilitly to revert arbitrary operations, to keep its
semantics simple and intuitive.

Related feature request "jj undo ergonomics":
https://github.com/jj-vcs/jj/issues/3700
2025-08-15 21:31:15 +00:00
Gaëtan Lehmann
8a9c356f5e touch: add an option to generate a new change-id 2025-08-14 17:36:20 +00:00
Gaëtan Lehmann
8bc11f272c touch: add options to modify author and author timestamp 2025-08-14 17:36:20 +00:00
Gaëtan Lehmann
de74f88cfc touch: a command to modify some revision metadata 2025-08-14 17:36:20 +00:00
Isaac Corbrey
55764e822c cli describe: Clarify short description for --reset-author
The short description for `--reset-author` previously made no mention of
updating the author timestamp as well as the author name and email. This
change adds verbiage to clarify that.
2025-08-10 11:42:43 +00:00
Joaquín Triñanes
a50147c23c docs: fix nested list rendering as top level
While the generated markdown is correct, it was being rendered as a
single list. This might be caused by the `mdx_breakless_lists` plugin
because the issue doesn't happen when the plugin isn't used (that is,
when the list actually has linebreaks above it).
2025-08-10 04:10:35 +00:00
Ivan Petkov
dc5056ac91 cli: git clone: support --fetch-tags 2025-08-08 15:44:22 +00:00
Ivan Petkov
144e2c9c63 cli: git remote add: support --fetch-tags 2025-08-08 15:44:22 +00:00
Austin Seipp
afb1c1446d git: add git.colocate to colocate repos by default
Most users colocate all of their repositories or none of them. A config
option is more convenient in that situation.

There are also plans to make colocated repos the default. This change
paves the way to flip the default easily.

Closes #2507.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-08-08 07:08:46 +00:00
Yuya Nishihara
8435ebaa9c cli: file show: add templating support
The primary use case is to insert header/separator when printing multiple file
entries.

"jj file show" accepts the same template argument as "jj file list", and file
content is not included in the template. This is basically the same as the
relation between "jj show" and "jj log".

Closes #7181
2025-08-07 14:52:02 +00:00
Stephen Jennings
3ad854f975 fix: add $root variable that can be used in commands
On Windows, spawning a child process finds the command relative to the
parent's working directory. If a command is specified as
`["path/inside/repo/tool.exe"]`, then tool won't be found if `jj fix` is
run from a subdirectory of the workspace.

There doesn't seem to be a good way to change this behavior, nor does it
seem easy to convert `program` into an absolute path because
`["tool.exe"]` could refer either to a file on the PATH or a file
committed at the root of the repository.

So, we add a new variable `$root` that can be used in this situation.
Workspace-relative tools on Windows should be defined using this
variable:

```toml
# Tools on the PATH
command = ["tool.exe"]

# Workspace-relative tools
command = ["$root/tool.exe"]
command = ["$root/nested/dir/tool.exe"]
```

On Unix, the command is found relative to the working directory of the
child process, so this isn't an issue.

Fixes #7144
2025-08-05 14:37:04 +00:00
Ilya Grigoriev
e160f7d9f6 cli help: document the ci alias, add comment for future
Follows up on 59de83a and #7019

Also added a comment to remind people to do this for new aliases.
2025-07-23 01:05:07 +00:00
Daniel Danner
4f0cb93b61 split: Clarify help text for --destination 2025-07-22 20:45:27 +00:00
Ori Avtalion
0c81caa0de docs: move mention of jj file track having no effect to the top of its description 2025-07-22 13:17:14 +00:00
Martin von Zweigbergk
a00b5b8327 cli: describe how commit is different from split 2025-07-21 19:34:31 +00:00
George Christou
f7377bd318 diffedit: add support for filesets 2025-07-21 08:00:29 +00:00
Martin von Zweigbergk
59de83a84a cli: move desc and st aliases to config
We generally prefer to define aliases in the default config so users
can override them.
2025-07-15 06:11:28 +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
Pavan Kumar Sunkara
c038ef4bc3 workspaces: Add templating support to workspace list 2025-07-07 19:14:07 +00:00
Yuya Nishihara
ea8aa1e17c index: don't preserve commits not referred to by operations/views
In this implementation, we assume that predecessor commits created by old jj are
reachable from at least one of the historical views. However, there are a couple
of commands which create transitive predecessors. For example, "jj squash" into
grandparent will rebase a rewritten source, so the pre-rebase source commit
won't be visible to any views. To work around the problem, all immediate
predecessors of historically visible commits are also preserved.

Note that this change should be considered forward-incompatible change. The
stored commits may have unreachable predecessors once we run "jj op abandon &&
jj util gc".

WalkPredecessors::flush_commits() doesn't need to guard against unreachable
commits. I was wondering whether values (or old ids) of op.commit_predecessors
map should be preserved, and I decided to keep both keys and values. It's nice
that we can get rid of index.has_id() calls when we drop support for legacy
commit.predecessors.
2025-07-03 09:06:21 +00:00
Yuya Nishihara
3a8b83d1fc cli: git-push: make "change" bookmark names templated
Someone asked this on Discord, and it's useful if the bookmark name should
include e.g. issue number (which can be extracted from commit description.)
2025-07-02 01:55:59 +00:00
Yuya Nishihara
26ba2a0975 cli: add "diff --template" argument
Since the commit template now supports diff.files(), it would probably make
sense that the diff command has the same functionality.

Closes #6681
2025-06-15 15:09:08 +00:00
Yuya Nishihara
e6c4890a0a cli: evolog: accept multiple starting revisions
There's no technical reason to restrict the starting revisions to a single
commit, and it will be nice that we can see evolution history of duplicated,
split, or divergent commits.
2025-06-15 01:59:33 +00:00
Vincent Ging Ho Yim
e72f161189 cli: fix typo in jj diff -r doc comment 2025-06-13 12:39:15 +00:00
Eyvind Bernhardsen
86f45b233b show: Accept short forms of ignore-space options
Make `jj show` accept the same short forms, `-b` and `-w`, as `jj diff`
for the `--ignore-space-change` and `--ignore-all-space` options.
2025-05-26 15:55:25 +00:00
Vincent Ging Ho Yim
365f26fe58 cli util completion: remove deprecated arguments for each shell
The optional arguments for each shell were deprecated in #2945 and v0.19.0.

The `shell` argument is now required, and Bash completions are no longer generated by
default if `jj util completion` is run without any arguments.
2025-05-22 02:51:51 +00:00
Vincent Ging Ho Yim
f4913512e2 cli util completion: add link to docs in doc comment 2025-05-22 02:51:51 +00:00
Scott Taylor
c406b3a929 rebase: skip duplicate divergent commits by default
This serves a similar purpose to Git's patch ID mechanism, however it is
slightly different in that it only compares commits which have the same
change ID as each other (divergent changes), and it does a full
comparison of the commits to see if they would have identical trees if
rebased onto the same parents. Since most changes aren't divergent, I
believe this should have a negligible performance cost in most cases.

I think skipping these commits by default makes sense for `jj rebase`,
since usually this will be a helpful behavior for the user. With this
behavior, a safe first step when encountering divergent changes would be
to rebase one branch on top of the other, since that will abandon any
divergent changes that have identical contents to existing commits,
leaving behind any non-trivial divergent changes for the user to resolve
manually.
2025-05-19 22:23:32 +00:00
Vincent Ging Ho Yim
db37450ef2 cli: sort top-level commands lexicographically
The Markdown docs have been regenerated as well.
2025-05-19 12:11:57 +00:00
Isaac Corbrey
85d54eb3d8 docs: Don't include unnecessary shebangs
It isn't necessary to include shebangs in scripts passed into
`util exec` since you're already explicitly calling out the shell you'd
like to use. This change removes shebangs from examples for `util exec`
and adds a note below calling this out.
2025-05-17 11:51:07 +00:00
Yuya Nishihara
88d79c135b cli: accept --tool=:<format> argument as builtin diff format
This is just for completeness. I don't think this is practically useful, but the
:<format> syntax should work in both config files and command arguments.
2025-05-17 00:11:00 +00:00
Gaëtan Lehmann
0b0d313583 split: use "selected/remaining changes" instead of "first/second commits"
With the new -A/-B/-d flags, the new commit may be created anywhere in
the tree, making the denomination first/second commit inaccurate.
2025-05-16 07:55:12 +00:00
Vincent Ging Ho Yim
20fd0b7daf cli bookmark move: move names argument before --from argument
The usage line originally showed `--from <REVSETS>|NAMES`, which was confusing as it
could be parsed as `--from (<REVSETS> or NAMES)`, rather than the correct `(--from
<REVSETS>) or NAMES`.

The order of the two arguments are now swapped, so that Clap displays it as
`NAMES|--from <REVSETS>` instead. Using bookmark names as the move targets should be
more common anyway. This is also consistent with the order in which the two arguments
are described in the command's doc comment.
2025-05-16 05:06:15 +00:00
Gaëtan Lehmann
193d9452b0 split: implement -A/-B/-d flags
the feature reused as much as possible of the `jj rebase` code, with
minimum modifications, in order to avoid reimplementing or complexifying
the rebase code.
It leads to some cases where some commits may be rewritten twice.

For example:

    ❯ jj -s
    @  ylrkuwto (empty) (no description set)
    ○  qsorlqym file4
    │  A file4
    ○  mmkvzzpw file3
    │  A file3
    ○  uttlrpzl file1&2
    │  A file1
    │  A file2
    ◆  zzzzzzzz root()

    ❯ jj split -r u -A m -m file1 file1
    Rebased 3 descendant commits
    First part: ulpvupsv aaf064bc file1
    Second part: uttlrpzl 0d4358c2 file1&2
    Working copy  (@) now at: ylrkuwto 60d905c5 (empty) (no description set)
    Parent commit (@-)      : qsorlqym 8cfbe2d8 file4

    ❯ jj -s
    @  ylrkuwto (empty) (no description set)
    ○  qsorlqym file4
    │  A file4
    ○  ulpvupsv file1
    │  A file1
    ○  mmkvzzpw file3
    │  A file3
    ○  uttlrpzl file1&2
    │  A file2
    ◆  zzzzzzzz root()

There is an intermediate state created as

    @  ylrkuwto (empty) (no description set)
    ○  qsorlqym file4
    │  A file4
    ○  mmkvzzpw file3
    │  A file3
    ○  uttlrpzl file1&2
    │  A file2
    ○  ulpvupsv file1
    │  A file1
    ◆  zzzzzzzz root()

where the commits in `uttlrpzl::` have been rewritten, then `ulpvupsv`
is moved, effectively rewriting the commits in `ulpvupsv::`.

The number of user visible rewritten commits is accurately reported.

`jj split --parallel` is still done as a special case: implementing
it with the rebase code would put the first commits on the right
branch.
2025-05-13 17:26:00 +00:00
Vincent Ging Ho Yim
bb115fe33d cli util gc: fix typo in doc comment 2025-05-13 10:15:13 +00:00
Martin von Zweigbergk
ee9917e102 rebase: avoid using "onto destination" when argument can be -A/-B
In parts of the description that are not about `-d` specifically, we
should not say "onto the destination". The message we print at the end
also says "onto destination". This updates both places to use "to"
instead of "onto".
2025-05-12 01:54:55 +00:00
Winter
bece25ccc7 cli: diffedit: remove confusing/redundant documentation
The former wording of "With the `-r` option, which is the default" is
confusing, and made redundant by the clarifications within the
option-level documentation.
2025-05-09 05:00:02 +00:00
Winter
dddb4045fe cli: diff: document default arguments more precisely
The former wording of "[w]ith the `-r` option, which is the default..." is
a bit confusing. This change brings `jj diff`'s documentation more in
line with the other commands with similar semantics, such as `jj rebase`.
2025-05-09 05:00:02 +00:00
Martin von Zweigbergk
8ee0bd45c7 status: update severely stale command description
The command has displayed all parents and the diff summary from the
merged parents since 48c44344bf (2022-12-04) but it still says that
it only cares about the first commit. This patch finally fixes that.
2025-05-09 00:48:55 +00:00
Gaëtan Lehmann
b31c4158cc split: add the --message option
to set the message on the first commit, where the selected
changes are going. The commit with the remaining changes
keeps the original description.
With this option it becomes possible to use split in a fully
non-interactive way, in combination with the filset feature.
It also makes jj split more consistent with other commands
like squash, commit or new.
2025-05-07 21:35:55 +00:00