Commit graph

1749 commits

Author SHA1 Message Date
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
Yuya Nishihara
2dd5934c74 cli: add debug command to enable changed-path index
Maybe we should add a config knob to enable changed-path index, do indexing in
background, etc., but I don't have a concrete idea.

Closes #4674
2025-08-15 11:46:49 +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
Yuya Nishihara
6bb26d8e73 index: include changed-path index in stats() 2025-08-11 11:50:39 +00:00
Gaëtan Lehmann
2e2127c56b log: add templates to anonymize the output 2025-08-10 19:24:36 +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
Daniel Luz
5d63b11e39 cli: provide file completion for util exec args
Makes command aliases provide similar completion to the shell's default.
2025-08-10 04:10:46 +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
Evan Martin
60a6e9421b cli: make diff --stat show byte counts for binary files
Fixes #6865.
2025-08-09 21:36:04 +00:00
Emily
5aa7b4cf7e tests: compute the schema defaults in Rust rather than using jq(1)
This is a simple computation over the JSON structure of the schema,
so it doesn’t need pulling in another programming language and a
dependency on an external C program to interpret it.
2025-08-08 16:19:30 +00:00
Emily
311299bab5 tests: use jsonschema directly instead of taplo(1)
This removes an external tool dependency, skips the complexities
of subprocessing, and avoids having to poke a hole in the macOS
Nix sandbox because of `reqwest` trying to read the system’s TLS
configuration.

Note that despite the `Cargo.lock` getting bigger, this is actually a
net reduction of dependencies, as Taplo is written in Rust and pulls
in not only `jsonschema` but much more besides.
2025-08-08 16:19:30 +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
Clément
7efb529add rebase: improve error messages when rebasing a change onto itself
The `-r` flag triggered a warning different from the `-s` one, while
being more explicit ("Cannot rebase 0000000 onto descendant 0000000" ->
"Cannot rebase 0000000 onto itself")
2025-08-07 08:37:31 +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
Daniel Luz
436e8bbbdd cli: restore: adjust error message for --revision
We've had a few occurrences of people asking for `jj restore -r`,
as an analogous to `jj squash -r`, when the error message should already
be telling them to try `--changes-in`. This suggests that the message
is not being read, perhaps because it's too long, and the suggestions
get lost in the noise. This is an attempt to improve its readability.

- Reduce the error part of the message to its essence
- Label the hints that are presented as such
- Remove mention of `--into` for brevity, as it doesn't seem to be a
  common interpretation of `-r`
2025-08-04 23:46:56 +00:00
Yuya Nishihara
abd7f43507 templater: add commit.files() function to list existing files
I think this can be useful in CLI tests. I noticed there are lots of "jj file
list" calls in https://github.com/jj-vcs/jj/pull/6141 which could be combined
with "jj log" outputs.
2025-08-02 01:30:29 +00:00
Yuya Nishihara
c45bce99e8 cli: op diff: show content diffs from first predecessor only
This is technically wrong because multiple predecessors should be considered
integrated into the rewritten commit, but I don't have a good idea to mitigate
the "squashed" diff problem. In "op diff", content diffs from the first
predecessor is practically useful.

Closes #7090
2025-08-01 01:11:41 +00:00
phoebe
c9aa05de7b ssh-signing: add revocation-list option 2025-07-29 12:46:36 +00:00
Martin von Zweigbergk
377642004f cli: print warning about git clean -fdx when creating colocated repo
We hear every now and then from users who have run `git clean -fdx`
and accidentally delete their repo. Let's at least warn users about it
when the create a colocated repo.

We could perhaps allow the `.jj/` directory to be inside a `.git/`
directory like Sapling does, but that seems a little ugly and it's a
larger change.
2025-07-28 17:18:49 +00:00
Austin Seipp
ba24140f1d cli, lib: move to Rust 2024 language edition
This applies a `cargo fmt` and fixes clippy lints to keep the build
properly working.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-07-28 17:05:41 +00:00
Pablo Brasero
585a7426f5 everything: ensure consistent spelling of "behavior" 2025-07-28 16:19:31 +00:00
Scott Taylor
e9eb3a0142 git: write empty blob when setting intent to add
Fixes #7062.
2025-07-27 15:13:02 +00:00
adamnemecek
8a26df2897 cli lib: make use of Self consistent
Mostly done via `cargo clippy --fix -- -A clippy::all -W clippy::use_self`. Added a rule to clippy rules.
2025-07-27 00:12:02 +00:00
Martin von Zweigbergk
a054ca9c92 diff: disallow diff of range with incoming merge edges
We could allow merge edges coming into the range of commits but it's
probably a rare use case and it's a bit complicated to implement while
also preserving the parent order. Simply disallowing such cases for
now is better than producing incorrect results.
2025-07-26 18:32:20 +00:00
Martin von Zweigbergk
3423543094 cli: demonstrate bug in jj diff -r with merge into chain 2025-07-26 18:32:20 +00:00
Yuya Nishihara
182daa1dfa str_util: switch to globset
Since we already have globset in transitive dependencies, this change helps
reduce the amount of dependencies. Another reason is that globset provides a
function to convert glob to regex. This is nice because we use globs to match
against strings or internal repository paths instead of platform-native paths.

The GlobPattern wrapper is boxed because globset::Glob type is relatively big.
2025-07-25 08:22:35 +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
Daniel Luz
2c0a1331be annotate: add original line number to template
Fixes #6103.
2025-07-22 20:29:05 +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
Remo Senekowitsch
00145e6aac absorb: complete only files changed in the --from revision 2025-07-21 05:13:25 +00:00
Kaiyi Li
9d817b6491 config: move fsmonitor settings out of core 2025-07-21 03:38:34 +00:00
Bryce Berger
38a23f9b24 diff stat: ensure bar always has 2 spaces for commits with adds and removes
closes #7026
2025-07-20 08:22:25 +00:00
Bryce Berger
2c84812748 diff tests: demonstrate bug in --stat with narrow terminal, adds, and removes 2025-07-20 08:22:25 +00:00
Ilya Grigoriev
d9c031c35b cli completion: remove non-functional diff editors/formatters
Follows up on  https://github.com/jj-vcs/jj/pull/7009
2025-07-19 18:09:01 +00:00
Ilya Grigoriev
fedbc3017f cli merge tools: allow setting diff-args=[] to disable diff formatting with a tool
Not setting `diff-args` is equivalent to `diff-args=["$left",
"$right"]`, which I also documented here.

I couldn't decide whether the new error should be part of
`DiffRenderError`, `DiffGenerateError`, or `MergeToolError`. Since the
treatment of diff formatters is already very different from other merge
tools, I just made it a CommandError for now.
2025-07-19 03:39:16 +00:00
Josh Steadmon
d7fa04f510 templater: add parents() method for Operation
Add a parents() method for `Operation` template objects, copied from the
implementation for `Commit`s.

The test case added in test_operations.rs was heavily inspired by
test_commit_templates.rs:test_log_parents().

Fixes #6979
2025-07-18 17:16:09 +00:00
Kaiyi Li
f1f1556731 local working copy: add support for EOL conversion 2025-07-17 15:36:28 +00:00
Evan Martin
d9b0a42a85 cli: make diff --stat fill available width
Previously, the computation for the available display width
included a padding constant, but this value was then used as
an upper bound for the width of the bar.  This meant the bar
would never fill the available screen width.
2025-07-17 02:03:16 +00:00
Evan Martin
228ea38aeb tests: make diff --stat test filenames clearer
Change the file names in the test to reflect a bit about what they're testing,
and add a test for a file that is a binary->binary modification.
2025-07-17 02:03:16 +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
Hubert Głuchowski
8ec0196aca status: collapse entirely untracked directories
This change makes status collapse directories which don't contain any
tracked files into one line so that large untracked directories don't
clutter up the status with loads of files.

For example for a tree like this:
```
T src/main.rs
U src/lib.rs
U tmp/a.txt
U tmp/b.txt
```

Previously the status would display these untracked paths:
```
? src/lib.rs
? tmp/a.txt
? tmp/b.txt
```

With this change it now looks like this:
```
? src/lib.rs
? tmp/
```
2025-07-14 19:41:27 +00:00
Ilya Grigoriev
13d747c807 cli completion: complete diff tools such as :git and :summary 2025-07-14 05:29:09 +00:00