2532 Commits

Author SHA1 Message Date
Yuya Nishihara
697cd504ff cli: pass clap::Error to map_clap_cli_error() 2025-03-08 04:33:09 +00:00
Yuya Nishihara
9bf2e9b20d cli: move tracing configuration out of parse_args()
This helps simplify the error type. It's also weird that the parsing function
sets up tracing subscription.
2025-03-08 04:33:09 +00:00
Yuya Nishihara
a27d925565 cleanup: switch to use<'_> capturing syntax
This patch fixes `'a: 'b, 'a` lifetime constraints, adds use<>, use<'_>, etc.
where the default would differ between editions. Redundant '_ is also removed.

https://doc.rust-lang.org/stable/edition-guide/rust-2024/rpit-lifetime-capture.html#edition-specific-rules-when-no-use-bound-is-present
2025-03-08 01:16:56 +00:00
Yuya Nishihara
b255dbed0a cleanup: remove unneeded lifetime capturing from snapshot_progress()
ui.progress_output() doesn't borrow anything from &Ui, and there would be no
reason to extend the borrow. Write ops on Ui don't require mutable instance.
2025-03-08 01:16:56 +00:00
Yuya Nishihara
df3c15a030 revset: remove support for multiple files() arguments
Since there are no revset functions that require at least N arguments, the
error message test is moved to test_templater.rs.
2025-03-08 00:54:28 +00:00
Yuya Nishihara
54868877d6 revset, templater: remove deprecated "branches" aliases 2025-03-08 00:54:28 +00:00
George Christou
ad39c97d04 cli: remove untrack subcommand 2025-03-07 11:00:08 +00:00
Yuya Nishihara
dfb10cab9b git: reject reserved remote name early in fetch() function
I'm going to make git::import_refs() not fail because of a real remote named
"git", but fetching from such remote should be an error.
2025-03-07 03:03:45 +00:00
Yuya Nishihara
b2fd1a002e git: extract helper to check unsupported remote name 2025-03-07 03:03:45 +00:00
George Christou
5eb3c5b658 cli: remove unsquash subcommand 2025-03-07 01:46:19 +00:00
Ilya Grigoriev
5eae2d92a0 tests: run insta --force-update-snapshots
This is a replacement for #5558.

Thanks to @yuja 's https://github.com/mitsuhiko/insta/pull/722, this is
now easy to generate.
2025-03-06 21:35:08 +00:00
Evan Mesterhazy
3ab5f1d197 cli split: Refactor and move tree selection to a function
This change moves the code for prompting the user to select changes for the
first commit to a helper function. There are no functional changes.

Resulting from the discussion in https://github.com/jj-vcs/jj/pull/5828
we are planning to add several new flags (-B, -A, and -d) to jj split.

Since this may change how the user selects changes (i.e. they may select
changes to remove from the target commit, rather than what stays in the target
commit), I want to move the selection logic to a function to make the main
split function more readable.
2025-03-06 14:38:29 +00:00
Evan Mesterhazy
707680be22 rewrite: Rename CommitToSquash to CommitWithSelection
Removing "Squash" from the name will allow this type to be used in split as
well without it being confusing.
2025-03-06 14:38:29 +00:00
Evan Mesterhazy
0b583ff3a7 cli split: Add a function to resolve the raw cli arguments
This is part of a refactor of cmd_split in preparation for adding new -A, -B,
and -d arguments to control where the changes split from the target commit end
up.

The goal is to simplify the flow in the main cmd_split function and manage
complexity introduced by the new options. In this case, the raw arguments will
be parsed once at the beginning of the command in resolve_args, after which the
raw SplitArgs are no longer used.

The function is pretty simple now, but will evolve once the new arguments are
added.
2025-03-06 14:38:29 +00:00
Yuya Nishihara
c6ed2afbfa tests: wrap formatter output so insta won't trim trailing whitespace
Not all tests should be strict about whitespace, but formatting tests usually
should.
2025-03-06 13:47:12 +00:00
George Christou
693be6cc02 config: remove support for git.push-branch-prefix 2025-03-06 11:47:01 +00:00
Jonathan Gilchrist
742bc8af1c config: Allow hiding the 'how to resolve conflicts' hint
This only deals with a single hint for now to resolve any discussions
around naming and approach.
2025-03-06 10:49:54 +00:00
George Christou
b7f7d923bd config: rename core.watchman.register_snapshot_trigger 2025-03-06 08:42:35 +00:00
Ilya Grigoriev
c36bfafb6a clippy: replace allow directives with expect or delete them when possible
Also resolves one TODO made possible by the new MSRV

Most of this was done by enabling the lint forbidding `allow` directives
using `cargo cranky`, running `cargo cranky --workspace
--all-featuers --fix`, and fixing up the result.
2025-03-06 07:24:28 +00:00
Ilya Grigoriev
1ede79c483 MSRV: Update to 1.84 and run clippy --fix, cargo fmt
The CI seems to correctly use rustc 1.84.1 (and not 1.84.0) with this.

For reference, we last updated the MSRV to 1.76 in 5b517b5. According to
https://releases.rs/docs/1.76.0/, this was when it barely became stable.

`flake.nix` seems to be using a nightly toolchain now, so it seems there
is no need to update the version there.

The more precise clippy command used was:

cargo clippy --workspace --all-targets --fix
2025-03-06 07:24:28 +00:00
Ilya Grigoriev
1449c2d040 debug init-local: remove the ui.allow-init-native option
It is not needed to gate `jj debug init-local` on an option now that the
command is no longer called `jj init`.

This also includes a separate fixup to #5845 in demos/
2025-03-05 05:52:02 +00:00
Ilya Grigoriev
5590e9473e jj debug init-local: fixup, docs
Fixups to #5845
2025-03-05 05:52:02 +00:00
Baltasar Dinis
4c5800ac4a cli/tests: port test_git_clone to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
09d92e8278 cli/tests: port test_git_fetch to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
876262a41b cli/tests: have clone helper take in a remote name
This is relevant for the git_fetch tests
2025-03-05 05:39:19 +00:00
Baltasar Dinis
a19787d2d4 cli/tests: port test_git_push to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
c2a92fce37 cli/tests: port test_git_remotes to gitoxide 2025-03-05 05:39:19 +00:00
Yuya Nishihara
4de95ac2f5 cli: reimplement "jj revert" stub as error hint
We might rename "jj backout" to "jj revert", but until then, user can add alias
as they want.

Closes #5335
Closes #5701
2025-03-05 05:22:51 +00:00
Yuya Nishihara
7711fc14e6 cli: sort debug commands lexicographically 2025-03-05 05:22:45 +00:00
Ilya Grigoriev
d446a85c4a cli: make init and clone print a friendly error but be overridable with aliases
The main goal here is so that a completely new user that types in `jj
init` or `jj clone` gets a pointer to the correct command needed to try
out `jj`.
2025-03-05 02:53:48 +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
Ilya Grigoriev
8bd7d3daea test_global_opts: use the Git backend
Follows up on #5875
2025-03-05 02:53:48 +00:00
Martin von Zweigbergk
88157c32b9 tests: avoid using the local backend
Now that we depend on the `git` executable being available for `jj git
fetch/push` tests, we might as well use it for `jj util gc` tests
too.

I also switched to using the Git backend in
`cli/tests/test_file_track_untrack_commands.rs`, which seemed to be
using the local backend for no good reason.
2025-03-04 22:12:17 +00:00
Benjamin Tan
ea8e4ac771 cli_util: extract shared compute_commit_location function
This will be used to compute the location to place commits from the
`--destination`, `--insert-after`, and `--insert-before` options. This
is used across the `new`, `duplicate`, and `rebase` commands, and can be
used for further commands as well.
2025-03-03 14:56:32 +00:00
Benjamin Tan
48b850b3a5 cli: new: --insert-after: remove special handling of commits which are ancestors
The previous implementation of `new --insert-after` excluded children
that were ancestors of the new commit. This was done to avoid creating
cycles in the commit graph. However, this does not align with the
behavior of the `--insert-after` in the other commands, which explicitly
error if inserting a new commit after the given `--insert-after` commits
would create a cycle.

For consistency, and given that the desired behavior can be achieved
using by using `--insert-after` along with `--insert-before`, this
behavior is removed.
2025-03-03 14:56:32 +00:00
Yuya Nishihara
7e8dba8d94 op_store: validate operation/view id length to detect corruption earlier
After system crash, file contents are often truncated or filled with zeros. If
a file was truncated to empty, it can be decoded successfully and we'll get
cryptic "is a directory" error because of an empty view ID. We should instead
report data corruption with the ID of the corrupted file.

#4423
2025-03-03 01:18:34 +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
Baltasar Dinis
038da961c0 cli/tests: move test_git_colocated_unborn_bookmarks to gitoxide 2025-03-01 09:54:31 +00:00
Baltasar Dinis
071e724c1c cli/tests: move test_git_colocated_fetch_deleted_or_moved_bookmark to gitoxide 2025-03-01 09:54:31 +00:00
Baltasar Dinis
05479df69e cli/tests: move most of the test_git_colocated tests to gitoxide 2025-03-01 09:54:31 +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
Evan Mesterhazy
2af5b60d32 cli split: Disable the new bookmark behavior for jj split
The consensus about this change, if one ever existed, seems to have dissolved
into two cohorts, one which is happy with the change, and one which thinks we
should move both the bookmark and change id to the child commit instead of
leaving them on the parent.

We may decide to add flags to allow users to choose between the two behaviors,
but there are also other concerns such as where @ should go (parent or child).
Until we agree on a path forward it seems reasonable to delay the breaking
change by disabling it via the config option we added. I don't think it's
necessary to fully revert the code and new tests since we aren't announcing the
option.


#3419
2025-02-28 23:23:06 +00:00
Evan Mesterhazy
8046ecefba cli split: Rename the "commit" variable to "target_commit"
This has bothered me for a while... It's useful to describe the target of the
split command as the "target commit", and it's a little confusing to have a
variable named "commit" in the code when we are dealing with several different
commits in the command.

I think this improves readability by being more precise.
2025-02-28 12:15:31 +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
Yuya Nishihara
b15769448b cli: provide better hint on bookmark name parse error
It should be better to say parsing failed, rather than starting with detailed
pest error message.
2025-02-28 07:27:40 +00:00
Yuya Nishihara
539f242e6c cli: print error sources if clap cannot parse arguments
Bookmark name error will be nested in order to provide a better error hint.
2025-02-28 07:27:40 +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
Aleksey Kuznetsov
cfcd034879 docs: Add pointers to usage of jj help -k <keyword>
Relates to #5306
2025-02-28 06:52:52 +00:00
Yuya Nishihara
ae8e6e8e8e view: port remote_bookmark accessors to RemoteRefSymbol 2025-02-26 03:17:45 +00:00