Commit graph

276 commits

Author SHA1 Message Date
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
Ilya Grigoriev
4f3d890bee docs cli reference: update and pin clap-markdown, include aliases in reference
clap-markdown doesn't follow semver, so I pinned the version exactly.
2025-05-03 00:35:12 +00:00
Winter
f3c4cc2155 cli: duplicate: add setting for templating the new commit descriptions
This allows the customization of the duplicated commit descriptions.

An ideal use case for this is emulating `git cherry-pick -x`, as
illustrated in the tests.
2025-04-13 21:49:47 +00:00
Emily
8c506006b2 docs: add diagrams for jj new --after and --before 2025-04-10 19:00:34 +00:00
Aleksey Kuznetsov
3eaff83bca cli: Add config setting for bookmark list sort order
This is a conclusion of #5849.
Config setting to list bookmarks in specified order.

Closes #3831
2025-04-08 08:06:29 +00:00
George Christou
47b7717e69 cli show: add --no-patch flag 2025-04-05 16:41:32 +00:00
Scott Taylor
a902e63e65 merge_tools: add ":ours" and ":theirs" merge tools
We may want to implement these as options to `jj resolve` instead in the
future, but this is a simpler solution for now.
2025-04-02 22:09:15 +00:00
Aleksey Kuznetsov
3c907cc019 cli: Add --sort option to the bookmark list command
This allows different sort orders for the bookmarks list, not only
alphabetically (by name).

Relates to #3831
2025-04-02 14:46:20 +00:00
Remo Senekowitsch
fb1a27ff09 cli: require --deleted to push deleted bookmarks 2025-04-01 15:58:50 +00:00
Ilya Grigoriev
9db0739320 cli git push: new --named NAME=REVISION argument to create and immediately push bookmark
Fixes #5472
2025-03-31 03:51:28 +00:00
Benjamin Tan
60ce0b87d8 cli: git: add git root command
This was discussed briefly in [1], and makes it easier to execute
scripts which require a reference to the Git directory.

[1]: https://github.com/jj-vcs/jj/discussions/5767#discussioncomment-12480764
2025-03-25 08:58:43 +00:00
Yuya Nishihara
9a615b5b62 config: relax bare string rule to accept middle apostrophes, etc.
Closes #5748
2025-03-22 09:00:44 +00:00
Yuya Nishihara
f37f927bc2 cli: abandon: remove --summary flag, just print elided list
AFAICT, this option was needed when we're going to abandon hundreds of commits.
However, I typically notice that I had to use --summary to suppress the output
after the fact. Since the list is now truncated up to 10 commits, I don't think
the --summary flag is useful anymore. This patch also removes the special case
for 1 item, which existed primarily for overriding --summary.
2025-03-19 05:32:26 +00:00
Benjamin Tan
2bf5d6aa8f cli: deprecate backout command 2025-03-17 15:03:29 +00:00
Benjamin Tan
8a816b2622 cli: add revert command
This adds a revert command which is similar to backout, but adds the
`--destination`, `--insert-after`, and `--insert-before` optoins to
customize the location of the new reverted commits.

`jj backout` will subsequently be deprecated.

Closes #5688.
2025-03-17 15:03:29 +00:00
Caleb White
669bfaf09b cli: config: support multiple user configuration files
Multiple user configs are now supported and are loaded in the following precedence order:
  - `$HOME/.jjconfig.toml`
  - `$XDG_CONFIG_HOME/jj/config.toml`
  - `$XDG_CONFIG_HOME/jj/conf.d/*.toml`

Which removes the need to set `JJ_CONFIG` for a multi-file approach.
Later files override earlier files and the `JJ_CONFIG` environment
variable can be used to override the default paths.

The `JJ_CONFIG` environment variable can now contain multiple paths separated
by a colon (or semicolon on Windows).
2025-03-15 18:43:42 +00:00
Yuya Nishihara
896424db76 templater: rename RefName type to CommitRef
I'm thinking of adding RefName(str) and RemoteName(str) newtypes, and the
templater type name would conflict with that. Since the templater RefName type
is basically a (name, target) pair, I think it should be called a "Ref", and I
added "Commit" prefix for disambiguation.

This isn't a breaking change since template type names only appear in docs and
error messages.
2025-03-14 14:58:29 +00:00
Caleb White
67e17d5474 cli: config list: show origin of config values
Adds a `templates.config.list` config option to control whether the
detailed list is shown or not.

The `builtin_config_list_detailed` template adds the config origin to
the end of the line for each config value in the list. Options coming
from files will show the file path.
2025-03-13 23:59:45 +00:00
Martin von Zweigbergk
dc7216d73a cli: diff: support multiple revisions to -r 2025-03-11 06:27:51 +00:00
Jo Liss
4e3f43c261 docs: explain that jj root is synonymous with jj workspace root 2025-03-10 21:44:06 +00:00
Caleb White
072af8448f cli: bookmark move: allow short aliases for --to/--from
If `--to` is going to become a required argument, it should
have a short alias as it will be used quite frequently.

Given that `--to` has a short alias it only makes sense to
allow `-f` for `--from` as this is consistent with other
commands and nothing makes this particular command special.
2025-03-10 13:02:08 +00:00
Ilya Grigoriev
7b38f82b3f cli op log: short -d alias for --op-diff
`--op-diff` is often more useful than `-p`/`--patch`.
2025-03-08 06:49:34 +00:00
Ilya Grigoriev
22bc271a7b cli: move jj init to jj debug init-local
We could also incorporate parts of #5827 later.
2025-03-05 02:53:48 +00:00
Burak Varlı
7b52ff51f0 cli git fetch: support string pattern syntax in remote option
Signed-off-by: Burak Varlı <unexge@gmail.com>
2025-03-01 12:11:19 +00:00
pylbrecht
7b229e6b97 sign: format link in help
Following the existing conventions for formatting links.
2025-03-01 07:31:55 +00:00
pylbrecht
0e498c7dcb sign: link to docs in jj sign and jj unsign 2025-03-01 07:31:55 +00:00
pylbrecht
e5ca254084 sign: add --key argument to jj sign
Following up on #4747 (see
https://github.com/jj-vcs/jj/pull/4747#discussion_r1968720554).
2025-02-28 07:52:57 +00:00
pylbrecht
c90f0b96a4 sign: add default revisions for jj sign
When signing commits with `jj sign`, one might want to use a workflow
like:

```bash
jj fix && jj sign .. && jj git push
```

Making the default value for `-r`/`--revisions` configurable, will allow
such a workflow.

Co-Authored-By: Yuya Nishihara <yuya@tcha.org>
2025-02-28 07:14:59 +00:00