Commit graph

976 commits

Author SHA1 Message Date
Michael Pratt
fc5cdf027c doc: integrate Gerrit FAQ into Gerrit guide
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Provide a bit more detail about the JJ to Gerrit change mapping, advice
on handling splits and squashes, as well as the existing FAQ
configuration for adding Change-Id directly to change descriptions.
2025-09-19 13:53:41 +00:00
George Christou
1a0e868e5c template: add string replace method 2025-09-19 09:01:07 +00:00
Austin Seipp
419bd51496 cargo: bump MSRV to 1.88
1.90 was just released, so this seems reasonable, and it finally lets us
use let-chains. This includes all the clippy fixups too, and some small
changes suggested by Ilya.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-09-19 01:03:21 +00:00
Austin Seipp
7ec5980f26 revset: add new exactly(x, n) expression
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
With `all:` having gone away, some users (including me) had been using it
to enforce an invariant: by omitting it, an expression was guaranteed to
yield exactly one result. For example, this is important when using tools
like `jj rebase -B/-A`

Instead, let's fix that case by building that functionality into the
revset language itself. The previous behavior can now be enforced via
the term `exactly(x, 1)`

In the future, `n` could also be a range.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-09-18 18:48:12 +00:00
Conner Petzold
208de3c00a docs: add changelog links
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-09-17 20:44:47 +00:00
Daniele Sassoli
92f325ef23 docs: add working with gerrit section
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Currently there are instructions on how to setup jj to work with GitHub,
but not Gerrit, which seems to be very popular with the jj community.

Add a gerrit.md file to help users discover the jj gerrit subcommand.
2025-09-16 21:16:13 +00:00
Yuya Nishihara
84c7f5d562 cli: diff: pass $width parameter to external diff tools
Closes #4161
2025-09-16 01:49:21 +00:00
Yuya Nishihara
af4fe21452 files, tree: make same-change conflict resolution configurable
I have no idea if we can change the default, but maybe we can conditionally
disable the same-change rule to get rid of hacks in squash_commits(), etc.?

resolve_file_executable() doesn't respect the Store configuration. I'm not sure
if that's the right choice, but it seemed better to accept duplicated change
than falling back to executable=false.

#6369
2025-09-11 13:14:28 +00:00
Stephen Jennings
08f2e21ebf config: add platforms conditional configuration
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Adds a new `--when.platforms` condition for including configuration.
This is useful when someone syncs their dotfiles across machines.

The values for `platforms` are defined by `std::env::consts::FAMILY` and
``std::env::consts::OS. Any Unix-family platform can be specified using
the value `"unix"`, or individual operation systems can be chosen with
`"linux"`, `"macos"`, or `"windows"`.

Example:

```toml
ui.pager = ["less", "-FRX"]

[[--scope]]
--when.platforms = ["windows"]
ui.pager = ["C:/Program Files/Git/usr/bin/less.exe", "-FRX"]
```
2025-09-11 06:33:20 +00:00
Austin Seipp
8e2820f130 templates: add hyperlink alias
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-09-09 09:18:12 +00:00
Yuya Nishihara
9589bec37a files: add option to resolve conflicts word by word
This option affects emptiness of commits, which means indexed changed files can
become stale on configuration change. This problem can also be said for changes
in the diff algorithms, so I don't think we need a logic to invalidate index on
config change.

I have this patch for months, and it seems working good at least for Rust
sources.

Closes #17
2025-09-09 03:44:16 +00:00
Matt T. Proud
3c20da336d docs: provide analogue for git checkout
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This commit includes a jj recipe for the Git command table that is
approximately equivalent to Git's checkout command, which can be used to
examine source code at named revision or branch.  This is indispensible
for learn-by-doing types who are curious how to remap Git usage back
onto jj with minimal effort.
2025-09-08 20:57:26 +00:00
Ilya Grigoriev
93368f114f codespell: forbid British English
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
As suggested by @PhilipMetzger

The word "grey" is whitelisted because
- we have a contributor of that name
- we use a library that uses "Grey" as a member of an enum
- I refuse to believe "grey" is not US English
2025-09-07 15:51:44 +00:00
Gaëtan Lehmann
75f0179665 doc: add helix configuration in the contributing page 2025-09-06 10:03:21 +00:00
Benjamin Tan
cd5e7316f1 docs: use relative links to Markdown files instead of linking to GitHub
This allows links to point to other pages in the generated mkdocs
documentation output instead of pointing to external GitHub URLs.
2025-09-06 09:37:03 +00:00
Benjamin Tan
b70a12e2db docs: standardize usage of term "colocate" without the hyphen
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
The hyphen-less version is preferred since there are already existing
command flags and config options which use the hyphen-less variation.
2025-09-05 16:32:25 +00:00
Reilly Brogan
1080396831 cli: Default to nano editor on Linux
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
The pico text editor is effectively absent from the majority of Linux
distributions, having been replaced with nano by virtually all of them.
Some distros have symlinks for `pico` that point to `nano`, but not all
of them. Using nano as the fallback option has a much lower chance of
failure than pico.

Co-authored-by: Remo Senekowitsch <remo@buenzli.dev>
2025-09-04 14:52:36 +00:00
Martin von Zweigbergk
c15cc344de cli: add jj bisect run command
This adds a command that automatically bisects a range of commits
using a specified command. By not having the interactive kind
(e.g. `jj bisect good/bad/skip/reset`), we avoid - for now at least -
having to decide where to store the state. The user can still achieve
interactive bisection by passing their shell as the bisection command.

Closes #2987.
2025-09-04 14:30:52 +00:00
Remo Senekowitsch
ec5c135387 git: colocate repos by default
Closes https://github.com/jj-vcs/jj/issues/7189

Colocated repos have some advantages and some disadvantages. On the
whole, I think making Git repos colocated by default is a better
trade-off, especially for new users. With the `git.colocate` setting,
(experienced) users can easily change this according to preference.

A non-exhaustive list of pros and cons of colocated repos:

pros:
* Many code editors show the changes one is currently working on based
  on Git's "dirty worktree".
* There are a lot of tools that integrate with Git which don't work at
  all in non-colocated repositories.
* There are a lot of Git features that Jujutsu doesn't have yet. When
  users ask for them, the answer is usually: "Just colocate your repo
  and run git directly for now." It's a strength that Jujutsu can focus
  on what makes it special and not have to rush the reimplementation of
  every niche feature of Git. Examples: `git rebase` tracking file
  renames, `git bisect`, `git tag`, `git range-diff`, submodules.

cons:
* Jujutsu performs worse in colocated repositories with lots of refs,
  because of the automatic `jj git import`.
* Colocated repos make branch@git references show up in Jujutsu output,
  which is usually just aesthetically displeasing or possibly even
  confusing to inexperienced users.
* Interleaving jj and (mutating) git commands can lead to confusing
  situations. Examples:
  * Creating a commit with git instead of jj will often leave a
    duplicate "work in progress" commit in Jujutsu's log.
  * Some IDEs periodically run `git fetch` in the background. This can
    lead to conflicted branches and divergent change IDs, something many
    people struggle with.
2025-09-04 11:26:28 +00:00
Gaëtan Lehmann
1e1decb594 dev: add mise config
The [vars] section is used to define the tool versions, and the tools
are only declared in each task in order to be able to run a task and
install only the required dependencies. This way

  mise build:docs

only install the docs dependencies, but not the rust toolchain.

The task are organized hierarchically, allowing to run all of the tasks
in a category, for example with

  mise run "check:*"

Some aliases for the most common tasks are defined in order to keep the
command line short and easy to type. For example use

  mise test squash

to run all the squash tests.

Co-authored-by: Emily <artyom@artyom.me>
2025-09-04 08:33:03 +00:00
Benjamin Tan
ba889a73df docs: improve description of different completion scripts
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-09-03 17:35:05 +00:00
Ilya Grigoriev
566478c7b0 paid contributors: add myself as a newly minted ERSC employee
🎉
2025-09-03 02:10:36 +00:00
Jade Lovelace
735a27d4ef templates: add string.match function
This allows for any matcher type and allows extracting a capture group
by number.
2025-09-02 02:19:54 +00:00
Jade Lovelace
30bb37967d templates: support string patterns in template language
This is a basic implementation of the same string pattern system as in
the revset language. It's currently only used for `string.matches`, so
you can now do:

```
"foo".matches(regex:'[a-f]o+')
```

In the future this could be added to more string functions (and e.g.
the ability to parse things out of strings could be added).

CC: https://github.com/jj-vcs/jj/issues/6893
2025-09-02 02:19:54 +00:00
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