Commit graph

952 commits

Author SHA1 Message Date
Ivan Petkov
032fd44b02 docs: update comment about simple fetch refspecs being respected
Now that https://github.com/jj-vcs/jj/pull/7275 has merged it's worth
mentioning that simple fetch refspecs will (now) be respected when other
branches are otherwise not specified on the CLI
2025-09-01 14:29:42 +00:00
Remo Senekowitsch
5947632027 config: use schema directive comment
Tombi is an LSP that complains about the "$schema" key, because it
itself is not actually part of our schema. Taplo is another LSP that
can read this comment directive. Using a comment seems generally more
appropriate. Syntax highlighting makes comments usually less visible,
indicating that the directive is not actually part of the configuration
data.
2025-08-29 14:52:30 +00:00
Stephen Jennings
72df6a5167 docs: Recommend unhiding revisions in the accidental changes FAQ
After a change has been accidentally modified, the user may want to
recover the original revision with the same commit ID if it was pushed
to a remote, not just restore the original contents.

Instead of using `jj restore` to restore contents, recommend using `jj
new <PREVIOUS_ID>` to unhide the original commit. This strategy works
whether or not the user cares about the original commit ID.
2025-08-29 05:30:42 +00:00
ase
3d8348f52d docs: link to type of self in template helptext 2025-08-28 10:27:11 +00:00
Remo Senekowitsch
b605639c49 cli: add redo command
This is the natural counterpart of `jj undo`. Adding `jj redo` closes
the last gap in functionality to the "undo" features of typical GUI
applications. This is much more intuitive to new users and useful than
the previous undo semantics. (Which are preserved as `jj op revert`.)

Related feature request "jj undo ergonomics":
https://github.com/jj-vcs/jj/issues/3700
2025-08-26 13:50:38 +00:00
Yuya Nishihara
535d8d48dd templater: serialize ConfigValue through toml::Value
We could instead implement serde::Serialize wrapper manually, but it would be
tedious to process recursive data structure. Let's just rely on the toml crate.
The cost of conversion wouldn't matter.
2025-08-25 05:52:46 +00:00
Martin von Zweigbergk
70477bcb2a docs: remove trailing whitespace
Some internal checks at Google reported this.
2025-08-25 00:05:21 +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
Nikhil Marathe
d2655f449d docs: Add a section for Selvejj
Selvejj is a plugin for JetBrains IDEs to support jj.
2025-08-22 14:31:08 +00:00
Tijs-B
3205692b81 docs: use commit ids in divergence example commands 2025-08-21 15:23: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
Yuya Nishihara
425b719045 templater: add CommitEvolutionEntry type
I don't have a strong feeling whether we should add "entry.commit() -> Commit"
method or forward method calls to the Commit object, but this patch implements
the former because:

 a. evolution_entry.diff() should return inter diff, whereas commit.diff()
    doesn't.
 b. auto-labeling works if self.commit() is an explicit method call.
 c. the implementation and documentation can be simple.

Tests will be added by the next patch.
2025-08-21 13:35:21 +00:00
George Christou
44ab63867d fileset: add case-insensitive glob patterns
Add support for case-insensitive glob patterns in filesets, similar to the
existing glob-i: patterns in revsets.

Resolves #5945
2025-08-20 10:51:51 +00:00
Martin von Zweigbergk
e8f91696fe style-guide: say that we prefer lower-level tests over e2e test
End-to-end tests using the `jj` binary are often easy and natural to
write, but it's easy to miss how much slower they are than `jj-lib`
tests.
2025-08-19 06:30:00 +00:00
Benjamin Tan
bb46ec23fe docs: update description of trunk() revset
This commit clarifies the order in which `trunk()` is resolved following
commit 5fedd36 (git init: prefer `upstream` over `origin` for `trunk()`
alias).
2025-08-18 13:28:32 +00:00
Remo Senekowitsch
6dc5d95e0d op: revert: fix missed string during rename from op undo
I only grepped for "undo", so "undid" slipped through the cracks.
2025-08-17 23:49:54 +00:00
George Christou
bb9882fba1 cli: op show: add templates.op_show configuration 2025-08-17 13:16:55 +00:00
George Christou
b89cce9162 template: add any and all methods to lists
This allows checking whether "any" or "all" elements in a list satisfy a given
predicate, similar to Python's native `any()` and `all()` functions, but
instead as list methods that take lambda predicates.

These new methods follow the same pattern as existing `filter` and `map`
operations, i.e. taking a lambda that receives each item and must return a
boolean.
2025-08-16 11:28:35 +00:00
Nigthknight
e6867a18b2 docs: add definition for remotes to glossary 2025-08-15 21:51:48 +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
d526a6f0fd template: add a hash function 2025-08-10 19:24:36 +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
Ivan Petkov
fa649051bb docs: add a note about rustfmt configuration for Nix/direnv users
The flake/devShell is already configured to pull in a nightly version of
`rustfmt` which means running `rustfmt +nightly` will actually fail
(since we aren't pulling in `rustup`).
2025-08-07 15:13:21 +00:00
George Elliott-Hunter
35a0bd330a docs: Fix 7176, document colocating a repo in Windows 2025-08-06 04:49:38 +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
Scott Taylor
9d8f351a09 docs: display optional arguments more simply
I was initially planning to try adding an `nth` keyword argument to
`parents()` instead of adding `first_parent()`, and I noticed that based
on the current style, it would have been shown as one of the following
in the revset documentation:

* `parents(x[, depth[, [nth=]index]])`
* `parents(x[, depth][, [nth=]index])`

These both seem difficult to read to me, so I'm proposing changing the
style to something more like this:

* `parents(x, [depth], [[nth=]index])`

I also added a brief section explaining the syntax in case it isn't
immediately obvious what the square brackets mean.
2025-08-04 23:56:38 +00:00
Stephen Jennings
5d732f4344 docs: Add guide for handling divergent changes 2025-08-04 18:59:02 +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
Scott Taylor
760ca1525b revset: add first_parent() function
Resolves #4579.
2025-07-31 22:17:05 +00:00
phoebe
c9aa05de7b ssh-signing: add revocation-list option 2025-07-29 12:46:36 +00:00
Apromixately
0aaf57b14d docs: fix fork_point example 2025-07-29 02:11:52 +00:00
Scott Taylor
1f8aede388 revset: add first_ancestors() function 2025-07-28 22:16:04 +00:00
Pablo Brasero
585a7426f5 everything: ensure consistent spelling of "behavior" 2025-07-28 16:19:31 +00:00
Nigthknight
c7e669ae54 docs: document how revsets can be prioritized in the log
Issue: #7081
2025-07-28 13:48:13 +00:00
Nigthknight
06831d0778 docs: document how to allow pushing new bookmarks by default
Issue: #7081
2025-07-28 13:48:13 +00:00
Martin von Zweigbergk
94b99b2460 revset: add naive version of bisect() function
This adds a version of the `bisect()` revset that simply takes the
midpoint of the input set when iterated over. That's correct in linear
history and probably usually good enough in non-linear history too. We
can improve it later. I think it's valuable to have this building
block even in an imperfect state.
2025-07-27 13:31:26 +00:00
Martin von Zweigbergk
b032fe2159 tutorial: fix incorrect change id in output
Closes #7084
2025-07-26 23:43:04 +00:00
Yuya Nishihara
ed931996d0 fileset: switch to globset
Unlike string patterns, backslash-escape syntax isn't forcibly enabled. Fileset
globs are constructed from platform-native path inputs.
2025-07-25 08:22:35 +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
Josh Steadmon
79939a3c62 docs: record orthros as a contributor whose employer pays for contributions 2025-07-24 04:53:13 +00:00
Daniel Luz
2c0a1331be annotate: add original line number to template
Fixes #6103.
2025-07-22 20:29:05 +00:00
Jake Martin
35590404cb docs: update the tutorial to fix a typo 2025-07-22 20:23:18 +00:00
Ori Avtalion
c69b55c39f docs: mention jj file track where snapshot.auto-track is described 2025-07-22 13:17:14 +00:00
Ori Avtalion
2ba52a433e docs: mention jj file track in FAQ about scratch files
It described how to disable auto-tracking, and didn't mention how to
track files.
2025-07-22 13:17:14 +00:00
Kaiyi Li
9d817b6491 config: move fsmonitor settings out of core 2025-07-21 03:38:34 +00:00
Martin von Zweigbergk
17ee58666d cargo: update MSRV to 1.85
Rust 1.85 lets us use async closure and switch to the 2024 edition.
2025-07-20 23:52:04 +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
Ilya Grigoriev
dae9ce7677 cli merge tools: allow setting edit-args=[] to disable diff editing with a tool 2025-07-19 03:39:16 +00:00
Ilya Grigoriev
2a221b0f8e docs config.md: explain unspecified merge-args/diff-args for a tool 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