2198 Commits

Author SHA1 Message Date
Benjamin Tan
e021036740 cli: backout: add templates.backout_description configuration
Closes #5676.
2025-02-14 07:56:40 +00:00
Josh Steadmon
23691a636c config-schema: validate default configs in tests with taplo
Set up tests using `taplo check --schema` to validate the default configs.
Install taplo in GitHub CI and in the Nix flake.

Fixes #5670.
2025-02-14 04:17:37 +00:00
Evan Mesterhazy
37992412b6 cli split: Recommend jj config set --user instead of --repo in deprecation warning
It only occurred to me after I rebuilt jj and actually had to run the command
that we should probably recommend a change to the user config instead of the
repo config.

#3419
2025-02-14 01:41:41 +00:00
Yuya Nishihara
381bb8a869 tests: create parent directory of .git link file by caller
It seems a bit safer to set up the working directory by caller who knows the
test environment directory exists.
2025-02-14 01:14:39 +00:00
Yuya Nishihara
d5493e6b10 tests: inline create_gitlink() option to caller
Since we don't set up Git worktree properly, it's odd that init_git_repo() has
a option to create a workspace at the specified path.
2025-02-14 01:14:39 +00:00
Yuya Nishihara
0d2becbac3 templater: add stringify(x) function to call string methods on template
It's also useful to remove color labels from the inner template.
2025-02-14 00:54:03 +00:00
Evan Mesterhazy
d5d21643d5 cli split: Add a config option controlling how bookmarks move during splits
Currently, `jj split` moves bookmarks from the target revision to the second
revision created by the split. Since the first revision inherits the change id
of the target revision, moving the bookmarks to the first revision is less
surprising (i.e. the bookmarks stay with the change id). This no-implicit-move
behavior also aligns with how `jj abandon` drops bookmarks instead of moving
them to the parent revision.

Two releases from now, `jj split` will no longer move bookmarks to the second
revision created by the split. Instead, local bookmarks associated with the
target revision will move to the first revision created by the split (which
inherits the target revision's change id). You can opt out of this change by
setting `split.legacy-bookmark-behavior = true`, but this will likely be
removed in a future release. You can also try the new behavior now by setting
`split.legacy-bookmark-behavior = false`.

Users who have not opted into the new behavior via the config setting will see
a warning when they run `jj split` informing them about the change. The default
behavior be changed in the future.

The `jj split` tests for bookmarks are updated to run in all three configurations:

- Config setting enabled
- Config setting disabled
- Config setting unset


#3419
2025-02-13 21:45:56 +00:00
Evan Mesterhazy
b90e5af51c json schema: Fix bad indentation for jj fix settings
The fix settings weren't indented consistent with the rest of the settings,
causing them to appear in the redacted snapshot in the test_util_config_schema
test.
2025-02-13 02:37:19 +00:00
hkalbasi
272955f4fe templater: add .escape_json method to string 2025-02-12 22:17:30 +00:00
Ilya Grigoriev
e83b328f71 ui.rs: style, fixup to 8aa2916 2025-02-12 21:25:37 +00:00
Josh Steadmon
69050f31f4 config-schema: expand options for ui.editor, ui.diff.tool, and ui.pager
In addition to a single string, the `ui.editor` and `ui.diff.tool` options also
allow arrays of strings. `ui.pager` allows arrays of strings as well as a nested
table describing both the command and the environment.

Update config-schema.json to allow all of these types of values.

Fixes #5617
2025-02-12 20:43:17 +00:00
Evan Mesterhazy
b2e2c79088 cli split: Move bookmark testing to a separate test
We are planning to add a config option that controls how bookmarks and change
ids move during `jj split` based on feedback in https://github.com/jj-vcs/jj/pull/5618.
I think the tests will be more readable after the config option is added if we
move the bookmark testing to its own test.

#3419
2025-02-12 19:45:37 +00:00
Baltasar Dinis
9ca6d179b2 cli/tests: port test_gitignore to gitoxide 2025-02-12 17:06:59 +00:00
Baltasar Dinis
6746942a06 cli/tests: port test_git_init to gitoxide
cargo-insta was re-run.
This is due to centralizing git interaction code to use a particular
different signature, which changes the commit hashes
2025-02-12 17:06:59 +00:00
Baltasar Dinis
18cd4d3010 cli/tests: add more gitoxide helpers
These are helpers for:
 - gitlinks
 - removing config values
 - symbolic references
 - status
 - index management
2025-02-12 17:06:59 +00:00
Ilya Grigoriev
a3647a6796 json schema: update some defaults to their modern values 2025-02-11 23:25:00 +00:00
Ilya Grigoriev
3f9e55ffee json schema: set schema version to draft-4, clarify taplo support
"$comment" is not officially supported by draft-4, but it is in newer
drafts, and JSON schema readers are supposed to skip fields that
are not known to them.
2025-02-11 23:25:00 +00:00
Ilya Grigoriev
dae1664ad3 json schema: fix color names failing validation
This makes the schema a bit less smart, but there's a good chance
`taplo` could not use "propertyNames" anyway because that comes
from a newer version of the schema than `taplo` officially supports
(see the child of this commit).

Fixes #5607
2025-02-11 23:25:00 +00:00
David Rieber
dd73b5ab7d bookmarks: First step to make target revision a required argument to bookmark create/move/set.
With this change a warning is shown if the user does not explicitly specify the target revision, but the behavior is unchanged (it still defaults to the working copy).
In the future the warning will be turned into an error. In other words, it will be required to specify target revision.

The bulk of the changes here are to prepare tests for the upcoming change, to make the transition easier.

For additional details please see:
* https://github.com/jj-vcs/jj/issues/5374
* https://github.com/jj-vcs/jj/discussions/5363
2025-02-11 22:21:19 +00:00
Martin von Zweigbergk
f291ac44db cli: add difftastic as diff tool
Difftastic is pretty popular tool. Let's add it as a diff tool so it's
easier to enable.
2025-02-11 18:00:01 +00:00
Martin von Zweigbergk
7b1820adba cli: sort tools in merge_tools.toml 2025-02-11 18:00:01 +00:00
Baltasar Dinis
39fe9aad3a cli/tests: remove allow(unused) from git helpers 2025-02-11 13:46:25 +00:00
Baltasar Dinis
5b174c9109 cli/tests: port test_git_import_export to gitoxide 2025-02-11 13:46:25 +00:00
Baltasar Dinis
4f6a2fcfc0 cli/tests: port test_commit_template to gitoxide 2025-02-11 13:46:25 +00:00
Baltasar Dinis
5076d0e6b1 cli/tests: port test_bookmark to gitoxide
cargo-insta was re-run.
This is due to centralizing git interaction code to use a particular
different signature, which changes the commit hashes
2025-02-11 13:46:25 +00:00
Baltasar Dinis
a8eb76f9c4 cli/tests: port test_operations to gitoxide
cargo-insta was re-run.
This is due to centralizing git interaction code to use a particular
different signature, which changes the commit hashes
2025-02-11 13:46:25 +00:00
Baltasar Dinis
d56d910db8 cli/tests: port test_undo to gitoxide 2025-02-11 13:46:25 +00:00
Baltasar Dinis
806e76613b cli/tests: port test_git_submodule to gitoxide 2025-02-11 13:46:25 +00:00
Baltasar Dinis
b80e73b7cf cli/tests: port test_tag_command to gitoxide 2025-02-11 13:46:25 +00:00
Baltasar Dinis
cd6141693b cli/tests: add gitoxide helpers 2025-02-11 13:46:25 +00:00
Baltasar Dinis
769dbd8f5f cli/tests: move test environment to its own file
The `mod.rs` was becoming crowded and this makes way for unrelated
additions to the test utilities module
2025-02-11 13:46:25 +00:00
Emily
77f54a267e git: enable subprocessing by default
Given the previously‐stated intention of making this default
for the 0.27 release, prepare for that decision ahead of time by
enabling subprocessing by default on trunk. This will help surface
any regressions and workflow incompatibilities and therefore give
us more information to decide whether to keep or revert this commit,
without inconveniencing any users who haven’t already opted in to
the bleeding edge.

Please feel free to revert without hesitation if any major issues
arise; this is not intended as a strong commitment to enable this
option for the next stable release if it turns out to not be ready. In
that case, it’s better that we learn that early on in the cycle,
rather than having to revert at the last minute or, worse, cutting
a stable release that we later find contains a serious regression.
2025-02-10 22:10:22 +00:00
Martin von Zweigbergk
1e25101cea
cli: status: replace "is clean" by "has no changes"
"The working copy has no changes" seems much easier to understand for
new users. Thanks to @Wilfred for the suggestion.
2025-02-10 08:01:50 -08:00
Martin von Zweigbergk
65dc6750e0 docs: move Git command table to a separate page
The table can be easy to miss in its current location.
2025-02-10 15:29:32 +00:00
Evan Mesterhazy
915fe8f11e cli split: Test how the working copy commit changes across multiple workspaces
When a commit is split, the second commit produced by the split becomes the
working copy commit for all workspaces whose working copy commit was the target
of the split.

This commit adds two tests for this behavior:

1. Split a commit which is the working copy commit for two workspaces.
2. Split a commit which is the working copy commit for only one of the two
   workspaces.

These tests check that the working copy commits for the workspaces are updated
correctly. Both parallel and non-parallel splits are tested.
2025-02-10 14:05:45 +00:00
Martin von Zweigbergk
ea10adfbd5 cli: delete unused variants of BuiltinToolError
Some variants became unused in bce8cb9.
2025-02-10 02:56:01 +00:00
Benjamin Tan
07c63ed182 cli: remove ui.allow-filesets configuration option
The "fileset" language has been enabled by default since v0.20.
2025-02-08 19:34:05 +00:00
Martin von Zweigbergk
9cab4d9a0b cli: describe how to set a config value with apostrophes
Apostrophes are not uncommon in e.g. `user.name`, so let's help the
user by providing examples.
2025-02-08 18:46:37 +00:00
avmikhailov
a16555f9af index: Return Result from heads
there are many ways to implement `heads` for your custom backend:
one involves calling `self.evaluate_revset` with a proper revset. 
However, it can return an error, but `heads` does not allow it.

In our implementation of the index backend we do exactly the above 
and we ended up with several unwraps which we are trying to avoid 
as it could potentially crash our prod jobs.

P.S. The same logic applies to many methods in this trait, but I am doing one at a time.
2025-02-07 13:45:47 +01:00
Jonathan Frere
42161257ca cli: op undo: show a warning when undoing an undo operation
One common issue that users run into with `jj undo` is that they expect
it to behave like an "undo stack", in which every consecutive `jj undo`
execution moves the current state further back in history. This is
(currently) an incorrect intuition - running multiple `jj undo` commands
back-to-back will only result in the previous non-undo change being
reverted, then un-reverted, then reverted, and so on.

This change adds a hint when the user runs `jj undo` multiple times
consecutively, suggesting that they may be looking for `jj op restore`,
which allows them to revert the whole state of the repository back to
a previous snapshot.
2025-02-07 08:27:16 +01:00
Ilya Grigoriev
4ba316d9f7 cli reference: fix jj git push link formatting
Currently, the rendering in
https://jj-vcs.github.io/jj/prerelease/cli-reference/#jj-git-push is
incorrect.

Fixup to 5b5a9e7
2025-02-06 17:35:20 -08:00
Josh Steadmon
975e1e1e24 templater: add optional ellipsis arg to truncate template functions
If an ellipsis arg is given to the truncate_* template functions, append (or
prepend) the ellipsis when the template content is truncated to fit the maximum
width.

Fixes #5085.
2025-02-06 11:34:33 -08:00
Yuya Nishihara
6574f12173 local_working_copy: scan directory entries excluded by auto-track pattern
Since we need to scan directory entries recursively in order to detect new
untracked paths, it doesn't make sense to reuse the .gitignore code path.

This change means all untracked file paths are listed in "jj status" even if
the whole directory is untracked. It might be a bit verbose, but should be
okay. Directories like node_modules should be excluded by .gitignore, not by
auto-track pattern.

Fixes #5389
2025-02-06 18:04:57 +09:00
Jacob Hayes
4787dfef16
Fix backends.ssh.allowed-signers type in config-schema 2025-02-06 12:26:49 +07:00
Yuya Nishihara
5396138ed5 cli: update "only_path" warnings to say fileset expression instead of path
It's technically more correct.
2025-02-06 00:45:44 +00:00
Yuya Nishihara
e091172b63 git: force git subprocess to not localize error messages
Since we parse error messages, we need to disable translation at all.
2025-02-05 16:20:13 +09:00
Ilya Grigoriev
f60014f3ee built-in pager: allow configuring streampager options
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in https://github.com/jj-vcs/jj/pull/4203#discussion_r1914372214

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
2025-02-05 02:38:11 +00:00
Ilya Grigoriev
8aa29169ea pager: refactor pager config (no-op)
In the future, we could consider adding a few more
special configs, e.g. `:pagerenv` that strictly uses
the `PAGER` environment variable, and `:unix` that
mimics Git's algorithm of trying `PAGER`, defaulting
to `less`, and setting `LESS`.
2025-02-05 02:38:11 +00:00
Yuya Nishihara
891fe085a6 templater: add DiffStats type to provide raw stats values
I originally considered adding `stats() -> DiffStats` which returns an
unprintable object, with deprecation of `.stat(width)` in favor of
`.stats().<method_to_render>(width)`. However, I couldn't find a good name for
the rendering function. This patch instead made the width parameter optional. I
think that's good because template language doesn't have to be overly strict.

Closes #4154
2025-02-05 00:31:16 +00:00
Yuya Nishihara
b9aef59f0d diff: extract DiffStats type and calculate() function
This will help write template based on diff.stat() result. #4154

show_diff_stats() isn't reimplemented as DiffStats method because I think
DiffStats can be moved to jj-lib.
2025-02-05 00:31:16 +00:00