1209 Commits

Author SHA1 Message Date
Ilya Grigoriev
c38e316a91 cli op diff: show changes to the working copy positions
I find this useful for debugging what happened sometimes,
e.g. after some concurrent operations mess.
2025-03-12 03:41:27 +00:00
Ilya Grigoriev
ca46ce1d3a view: store working copies in BTreeMap
This is analogous to how bookmarks are stored and simplifies the
following commit.
2025-03-12 03:41:27 +00:00
Martin von Zweigbergk
dc7216d73a cli: diff: support multiple revisions to -r 2025-03-11 06:27:51 +00:00
Emily
fe9e71b90e git: remove .gitmodules parsing code
This is redundant with `gix`’s native API and not used by anything
but a hidden debugging command.
2025-03-11 02:37:13 +00:00
Jo Liss
4e3f43c261 docs: explain that jj root is synonymous with jj workspace root 2025-03-10 21:44:06 +00:00
Caleb White
072af8448f cli: bookmark move: allow short aliases for --to/--from
If `--to` is going to become a required argument, it should
have a short alias as it will be used quite frequently.

Given that `--to` has a short alias it only makes sense to
allow `-f` for `--from` as this is consistent with other
commands and nothing makes this particular command special.
2025-03-10 13:02:08 +00:00
Yuya Nishihara
c0066083ad git: make import of refs/remotes/git/* non-error, warn failed refs instead
I'm going to reimplement git_ref_filter to process translated remote bookmark
names, and "git" remote will mean the local Git-tracking remote there. The
reserved remote name is checked prior to filtering because refs in that remote
cannot be represented as remote symbols.

I originally implemented the error handling the other way because we didn't
have a machinery to report partial import failure. Now we have stats, it's
easy to report skipped ref names.
2025-03-10 02:04:33 +00:00
Yuya Nishihara
cc1b716d39 git: plumbing to report unimportable refs, warn non-utf-8 names
Tests will be added by the next patch. It's not important to report non-utf-8
refs, but this patch implements it as doing that was easy.
2025-03-10 02:04:33 +00:00
Emily
2e0bdd3396 cli: use gix in maybe_set_repository_level_trunk_alias 2025-03-09 21:17:10 +00:00
Emily
c25aa6e417 git: abstract git2 in remote management API
This is more consistent with other similar APIs and minimizes churn
in the test code as we move these to `gix`.
2025-03-09 21:17:10 +00:00
Yuya Nishihara
3318d172ff cli: bookmark: scan deleted local bookmarks in separate loop
We no longer have to do multiple things in one loop.
2025-03-09 09:33:07 +00:00
Yuya Nishihara
791e04954e cli: bookmark: collect all list items to temporary vec
I think this will help implement sorting options. Untracked remote bookmarks
should be sorted independently, whereas tracked remote bookmarks should always
be listed after the associated local bookmarks.
2025-03-09 09:33:07 +00:00
Benjamin Tan
c248d97679 cli: debug copy-detection: fix help text
It looks like the help text was copied from another command and not
updated.
2025-03-08 15:28:55 +00:00
Ilya Grigoriev
7b38f82b3f cli op log: short -d alias for --op-diff
`--op-diff` is often more useful than `-p`/`--patch`.
2025-03-08 06:49:34 +00:00
George Christou
ad39c97d04 cli: remove untrack subcommand 2025-03-07 11:00:08 +00:00
George Christou
5eb3c5b658 cli: remove unsquash subcommand 2025-03-07 01:46:19 +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
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
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
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
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
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
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
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
Yuya Nishihara
4b06274785 view: make remote bookmark iterators yield RemoteRefSymbol instead of tuple
This also changes formatting of remote symbol to use revset compatible form.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
6c71f3cbf2 git: use RemoteRefSymbolBuf to represent RefName::RemoteBranch variant
This also changes the formatting to use revset compatible form.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
c63a7fa4d2 cli: bookmark: replace RemoteBookmarkName with RemoteRefSymbol
Now remote bookmark names are printed in revset compatible form.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
cdd62a68f1 cli: bookmark: borrow remote bookmark names from cloned repo
This will help port find_remote_bookmarks() to RemoteRefSymbol<'_>.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
4729a01082 cli: git: use RemoteRefSymbol type to specify trunk() alias 2025-02-26 03:17:45 +00:00
pylbrecht
f7ceac3bf4 unsign: implement jj unsign command
The output of `jj unsign` is based on that of `jj abandon`.

We output warnings when unsigning commits, which are not authored by the
user. This is encouraging to use `jj undo`, in case one unintentionally
drops signatures of others.

---

Co-authored-by: julienvincent <m@julienvincent.io>
Co-authored-by: necauqua <him@necauq.ua>
2025-02-25 13:36:44 +00:00
Anton Bulakh
76f79961fb sign: implement the jj sign command
We always sign commits. This means commits, which are already signed,
will be resigned. While this is cumbersome for people using hardware
devices for signatures, we cannot reliably check if a commit is already
signed at the moment (see https://github.com/jj-vcs/jj/issues/5786).

We output warnings when signing commits, which are not authored by the
user. This is encouraging to use `jj undo`, in case one unintentionally
signs commits of others.

The output of `jj sign` is based on that of `jj abandon`.

---

Co-authored-by: julienvincent <m@julienvincent.io>
Co-authored-by: necauqua <him@necauq.ua>
2025-02-25 13:36:44 +00:00
Yuya Nishihara
37bfc64cf2 working_copy: do not update watchman clock if untracked files exist
This means that watchman is partially disabled until the user cleans up
untracked files. This isn't nice, but should be better than hiding untracked
files forever.

Fixes #5728
Fixes #5602
2025-02-24 08:22:21 +00:00
Bryce Berger
a17ed203ab fix: invoke tools from the workspace root
Previously, tools invoked by `jj fix` did not have their
`.current_dir()` set, and would just run from whatever directory the
user was in.

Now, the tools will always be invoked from the same directory that
`jj root` gives.

As a motivating example, consider a configuration path that's always at
the workspace root:

```toml
[fix.tools.something]
# previous:
command = ["cmd", "--config", "$root/tool.toml"]
#                              ^^^^^^ not possible
# now:
command = ["cmd", "--config", "./tool.toml"]
#                              ^^ now, just use a relative path
```
2025-02-23 02:21:57 +00:00
Antoine Martin
631b9ada3d track: only print snapshot stats and hints once
Move the `track` specific logic to track.rs, let print_snapshot_stats
handle just the default case.

Previously print_snapshot_stats would get called twice and could warn
twice about a file (if that file was both in the auto-track fileset as
well as in the fileset passed to `jj file track`), so now we merge the
snapshot stats and display appropriate hints for each file.
2025-02-21 17:35:04 +00:00
Antoine Martin
984c7aae20 cli_utils: make snapshot stats printing optional
Snapshot stats were automatically printed when calling
`WorkspaceCommandHelper::snapshot_working_copy`. This has been moved up
the call chain to allow more choice in when to actually print stats.

These functions used to trigger printing of the snapshot stats via
(direct or indirect) calls to `snapshot_working_copy`:

- CommandHelper::workspace_helper_with_stats
- CommandHelper::recover_stale_working_copy
- WorkspaceCommandHelper::maybe_snapshot_impl

This means we can now chose not to print the snapshot stats if we know
we will perform another snapshot operation during the same command, to
reduce the number of warnings and hints shown to the user.

Calling `workspace_helper`, or `maybe_snapshot` instead of
`workspace_helper_with_stats` and `maybe_snapshot_impl` still prints
stats automatically.
2025-02-21 17:35:04 +00:00