8712 Commits

Author SHA1 Message Date
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
Yuya Nishihara
821f6b0f8b revset: externalize RemoteSymbol variant by using RemoteRefSymbol types
A struct with named fields should be more readable than unnamed arguments pair.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
201603f48f refs: add RemoteRefSymbol { name, remote } types
I'm going to fix some CLI outputs to print remote symbols in revset syntax, and
it's easier if the view API took/returned type that represents a ref name.

.as_ref() and .to_owned() are implemented as non-trait methods because
RemoteRefSymbol can't be a true reference type. I think it's similar to
Option::as_ref(). I couldn't find any std examples of non-trait .to_owned(),
though.
2025-02-26 03:17:45 +00:00
dependabot[bot]
f642ca8dda github: bump taiki-e/install-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [taiki-e/install-action](https://github.com/taiki-e/install-action).


Updates `taiki-e/install-action` from 2.49.1 to 2.49.4
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](ae97ff9daf...6c595e9f7b)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-26 01:44:51 +00:00
Martin von Zweigbergk
0e2d079ef8 github: fix invalid permission settings for docs workflow
Similar to #5792. We haven't had any updates to the GitHub pages since
#5076, AFAICT.
2025-02-25 16:41:26 +00:00
Yuya Nishihara
2fd842ebf7 tests: normalize formatting in insta macro that could leave trailing whitespace
rustfmt occasionally complains about that.
2025-02-25 15:40:14 +00:00
Yuya Nishihara
7fa8420908 tests: resolve directory path to run_jj_in() relative to env_root
Suppose we'll add test_env.init_workspace(path) or something, this will probably
make sense.
2025-02-25 15:40:14 +00:00
Yuya Nishihara
3634ff298c tests: simplify jj_cmd() interface, rename to new_jj_cmd() 2025-02-25 15:40:14 +00:00
Yuya Nishihara
28803eef94 tests: rewrite remaining callers of jj_cmd() to use run_jj_in/with() 2025-02-25 15:40:14 +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
dependabot[bot]
cdc9c69a8f github: bump the github-dependencies group with 5 updates
Bumps the github-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.0` | `4.6.1` |
| [taiki-e/install-action](https://github.com/taiki-e/install-action) | `2.48.20` | `2.49.1` |
| [EmbarkStudios/cargo-deny-action](https://github.com/embarkstudios/cargo-deny-action) | `2.0.5` | `2.0.6` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.9` | `3.28.10` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.0` | `2.4.1` |


Updates `actions/upload-artifact` from 4.6.0 to 4.6.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65c4c4a1dd...4cec3d8aa0)

Updates `taiki-e/install-action` from 2.48.20 to 2.49.1
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](2dbeb927f5...ae97ff9daf)

Updates `EmbarkStudios/cargo-deny-action` from 2.0.5 to 2.0.6
- [Release notes](https://github.com/embarkstudios/cargo-deny-action/releases)
- [Commits](13fd9ef18c...0484eedcba)

Updates `github/codeql-action` from 3.28.9 to 3.28.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9e8d0789d4...b56ba49b26)

Updates `ossf/scorecard-action` from 2.4.0 to 2.4.1
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](62b2cac7ed...f49aabe0b5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 01:26:19 +00:00
Baltasar Dinis
653cc6c1c9 lib: move git_backend tests to gitoxide
This forces some code duplication to avoid depending on the testutils.
2025-02-24 21:02:29 +00:00
dependabot[bot]
712e659e49 cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap), [either](https://github.com/rayon-rs/either) and [libc](https://github.com/rust-lang/libc).


Updates `clap` from 4.5.30 to 4.5.31
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.30...v4.5.31)

Updates `clap_complete` from 4.5.45 to 4.5.46
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.45...clap_complete-v4.5.46)

Updates `either` from 1.13.0 to 1.14.0
- [Commits](https://github.com/rayon-rs/either/compare/1.13.0...1.14.0)

Updates `libc` from 0.2.169 to 0.2.170
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.170/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.169...0.2.170)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: either
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 18:45:08 +00:00
Martin von Zweigbergk
a3664f77ed github: fix invalid permission settings for scorecards workflow
In https://github.com/jj-vcs/jj/actions/runs/13490171888, we got this error:

```
Invalid workflow file: .github/workflows/scorecards.yml#L48
The workflow is not valid. .github/workflows/scorecards.yml (Line: 48, Col: 9): Unexpected value 'permissions'
```

It looks like permissions can be set per job but not per step, so I
moved the permission setting to the job level.
2025-02-24 16:33:04 +00:00
Yuya Nishihara
ad6985fd9c tests: migrate unusual patterns of jj_cmd_ok() to run_jj_in()
These callers are manually ported to run_jj_in().
2025-02-24 15:39:11 +00:00
Yuya Nishihara
804d175fd9 tests: migrate non-snapshot users of jj_cmd_ok() to run_jj_in().success()
These callers were mostly substituted mechanically.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
3193513049 tests: migrate snapshot users of jj_cmd_ok() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up formatting.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
255532b6b8 tests: reorder comments and snapshots, split insta::allow_duplicates! { .. }
This helps replace jj_cmd_ok() by pattern matching.
2025-02-24 15:39:11 +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
Yuya Nishihara
b7e2932dba tests: compare CommandOutput where makes sense 2025-02-24 00:57:24 +00:00
Yuya Nishihara
c9926eae4c tests: implement Debug and Eq for CommandOutput
This helps assert that two command invocations generate exactly the same
results.
2025-02-24 00:57:24 +00:00
Yuya Nishihara
a1270f0149 tests: remove stale comment about CommandOutput wrapper 2025-02-24 00:57:24 +00:00
Yuya Nishihara
c83abc9dec tests: migrate non-snapshot users of jj_cmd_success() to run_jj_in().success() 2025-02-23 13:34:17 +00:00
Yuya Nishihara
cdcc777730 tests: migrate snapshot users of jj_cmd_success() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up minor
formatting and name errors.
2025-02-23 13:34:17 +00:00
Yuya Nishihara
317993894b tests: migrate unusual users of jj_cmd_success() to run_jj_in/with()
These callers are manually ported to run_jj_in(). assert_eq!() is changed to
insta::assert_snapshot!() where possible.
2025-02-23 13:34:17 +00:00
Yuya Nishihara
a326b6e792 tests: migrate jj_cmd_success() output wrappers to run_jj_in() 2025-02-23 13:34:17 +00:00
Yuya Nishihara
2543329c78 tests: remove unused jj_cmd_panic() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
79a0867050 tests: migrate callers of jj_cmd_internal_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
b79b29c288 tests: migrate callers of jj_cmd_cli_error() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
14ad894e47 tests: rewrite some alias tests to use normalize_stderr_with() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
d19e58f591 tests: migrate callers of jj_cmd_failure() to run_jj_in() 2025-02-23 03:06:59 +00:00
Yuya Nishihara
696cfee55f tests: stop using assert_eq!() in cli tests where possible
Normalize the output instead.
2025-02-23 03:06:59 +00:00
Yuya Nishihara
7c2f723935 tests: unify parsing output helpers in revset and templater tests
run_jj_in() can handle both success and failure cases.
2025-02-23 03:06:59 +00:00
Bryce Berger
708e1c58cd cli: improve hint message when suggesting --ignore-immutable
There have been a number of users confused about why
their commits are immutable, or what to do about it, ex.
[https://github.com/jj-vcs/jj/discussions/5659].

Separately, I feel that the cli is too quick to suggest
`--ignore-immutable`, without context of the consequences. A new user
could see that the command is failing, see a helpful hint to make it not
fail, apply it and move on. This has wildly different consequences, from
`jj squash --into someone_elses_branch@origin` rewriting a single commit,
to `jj edit 'root()+'` rewriting your entire history.

This commit changes the immutable hint by doing the following:

* Adds a short description of what immutable commits are used for, and a
  link to the relevant docs, to the hint message.
* Shows the number of immutable commits that would be rewritten if
  the operation had succeeded.
* Removes the suggestion to use `--ignore-immutable`.
2025-02-23 02:24:43 +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
Yuya Nishihara
5fbd4f26f6 tests: accept duplicated snapshots in test_resolve_symbol_change_id()
I didn't notice this function had #[test_case(..)].
2025-02-23 02:13:57 +00:00
Bryce Berger
35936463ed cli: warn when command differs after --config, including when subcommand not found
Aliases and `ui.default-command` are loaded before `--config` and
`--config-file` arguments are parsed (#5282).

There is supposed to be a warning when the result of these arguments
would change the parsed args: #5286.

However, that warning was not being printed if the arguments failed to
parse due to an unrecognized subcommand. Example:

```bash
# correct:
$ jj --config ui.default-command=nonsense
Warning: Command aliases cannot be loaded from -R/--repository path or --config/--config-file arguments.

# previous, confusing:
$ jj --config aliases.some-alias=nonsense some-alias
error: unrecognized subcommand 'some-alias'

# now:
$ jj --config aliases.some-alias=nonsense some-alias
Warning: Command aliases cannot be loaded from -R/--repository path or --config/--config-file arguments.
error: unrecognized subcommand 'some-alias'
```
2025-02-22 20:19:42 +00:00
dependabot[bot]
a031defcff github: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [taiki-e/install-action](https://github.com/taiki-e/install-action) and [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv).


Updates `taiki-e/install-action` from 2.48.19 to 2.48.20
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](55451daf94...2dbeb927f5)

Updates `astral-sh/setup-uv` from 5.2.2 to 5.3.0
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](4db96194c3...1edb52594c)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: astral-sh/setup-uv
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-22 01:48:48 +00:00
Yuya Nishihara
679a5c567a tests: migrate some jj_cmd_ok() output wrappers to run_jj_in()
Some of the wrapper functions are deduplicated as we can now handle success
and failure cases in the same way.
2025-02-22 01:23:04 +00:00
Yuya Nishihara
f1cd3a4e53 tests: migrate some jj_cmd_success() output wrappers to run_jj_in() 2025-02-22 01:23:04 +00:00
Yuya Nishihara
18ea718113 tests: migrate some helper functions that uses jj_cmd_*() to run_jj_in()
Snapshotted operation IDs are changed because this patch reorders "jj new"
command arguments.
2025-02-22 01:23:04 +00:00
George Christou
e1abaca21c templater: add trim methods to String type 2025-02-21 21:23:11 +00:00
Baltasar Dinis
837250277e lib/tests: port lib tests to gitoxide
As per #5548, this moves the majority of the tests in lib/test over to
gitoxide
2025-02-21 18:41:30 +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
0d02e855cd cli_utils: extract warning printing code from print_snapshot_stats
This will be re-used in the `track` command.
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
Yuya Nishihara
1d3558ff96 tests: rewrite change ID resolution test to not rely on git::import_refs()
It should be simpler to assign change IDs explicitly. Maybe we didn't have
.set_change_id() before?
2025-02-21 06:30:38 +00:00
George Christou
f77e64391d cli: add support for Sublime Merge 2025-02-21 05:44:53 +00:00