8719 Commits

Author SHA1 Message Date
Yuya Nishihara
bf53953c46 tests: port test_evolog_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
4f192d0162 tests: port test_edit_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
082602f2da tests: port test_duplicate_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Emily
fbb14a1b2f github: use the D: drive on Windows 2025-03-19 01:23:58 +00:00
dependabot[bot]
be432750bd github: bump the github-dependencies group with 2 updates
Updates the requirements on [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) and [taiki-e/install-action](https://github.com/taiki-e/install-action) to permit the latest version.

Updates `dtolnay/rust-toolchain` to 888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](888c2e1ea6)

Updates `taiki-e/install-action` from 2.49.24 to 2.49.29
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](0f58b6a196...62730e3d4f)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-type: direct:production
  dependency-group: github-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-03-18 20:50:16 +00:00
dependabot[bot]
f6237f07fd cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [async-trait](https://github.com/dtolnay/async-trait), [git2](https://github.com/rust-lang/git2-rs) and [rustix](https://github.com/bytecodealliance/rustix).


Updates `async-trait` from 0.1.87 to 0.1.88
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.87...0.1.88)

Updates `git2` from 0.20.0 to 0.20.1
- [Changelog](https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.0...git2-0.20.1)

Updates `rustix` from 1.0.2 to 1.0.3
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: git2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: rustix
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 16:27:53 +00:00
Yuya Nishihara
322c9951cf ui: do not pass empty choice input to parse function
Since prompt_choice_with() is now public, it should handle the default value
more consistently. parse() shouldn't be a function that can potentially feed a
default value.

We no longer print "unrecognized response" on empty input. I think this is
correct because an empty input is noop.
2025-03-18 15:43:43 +00:00
Yuya Nishihara
c2c2196b14 cli: split name/email not configured message to warning and hint
We usually print a short error message plus detailed hints.
2025-03-18 14:35:54 +00:00
Yuya Nishihara
b9e88be191 cli: extract common formatting function for updated working-copy stats
It's not important to print the parent commits on update-stale, but there should
be no reason to deviate the output formatting.
2025-03-18 14:35:54 +00:00
Yuya Nishihara
ccf927e1d8 cli: pass CheckoutStats to "print" function by reference 2025-03-18 14:35:54 +00:00
Yuya Nishihara
1a4d8dbbf4 ui: reimplement prompt_yes_no() by using prompt_choice_with()
It was odd that uppercase "Y"/"N" wasn't accepted.
2025-03-18 11:17:34 +00:00
Yuya Nishihara
083292d198 ui: extract prompt_choice_with(..callback)
I think "jj next/prev" prompt can also support selection by change ID prefix.
Maybe we can also add ui.prompt_choice_range(prompt, range, default) if that's
common?
2025-03-18 11:17:34 +00:00
Vincent Ging Ho Yim
7e1433a333 docs: fix missed rename of LocalBackend to SimpleBackend
This is a follow-up to f8ab8a0e.
2025-03-18 06:52:00 +00:00
Vincent Ging Ho Yim
a523503dbc docs: update types diagram to reflect rename of LocalBackend to SimpleBackend
This is a follow-up to f8ab8a0e.
2025-03-18 06:52:00 +00:00
Ilya Grigoriev
2a4b2dedf0 simple backend: document the lack of fetching and pushing
This is barely worth doing, but since I did it once...

I feel that some people might treat the simple backend as an easter egg, and
this will help them know what to expect.
2025-03-18 06:38:18 +00:00
Ilya Grigoriev
659325f9c3 cli git fetch: stop tracing the arguments of the outer function
The important arguments are traced in the inner function.

Previously:

```
2025-03-18T05:01:44.714692Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))], remotes: [Exact("upstream")], all_remotes: false }}:fetch{remote_name="upstream" branch_names=[Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))] depth=None}: jj_lib::git_subprocess: spawning a git subprocess cmd=LC_ALL="C" "git" "--git-dir" "/Users/ilyagr/dev/jj/.git" "branch" "--remotes" "--delete" "--" "upstream/master"
```

Now:

```
2025-03-18T05:06:29.573444Z DEBUG run_command:cmd_git_fetch:fetch{remote_name="upstream" branch_names=[Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))] depth=None}: jj_lib::git_subprocess: spawning a git subprocess cmd=LC_ALL="C" "git" "--git-dir" "/Users/ilyagr/dev/jj/.git" "branch" "--remotes" "--delete" "--" "upstream/master"
```
2025-03-18 06:02:05 +00:00
Ilya Grigoriev
1247aaf7f0 lib str_utils: make debug output for Glob StringPatterns more concise
For example, we'll have `Glob(GlobPattern("ig/*"))` instead of the
former

```
Glob(Pattern { original: "ig/*", tokens: [ Char( 'i', ), Char( 'g', ), Char( '/', ), AnySequence, ], is_recursive: false,
})
```
2025-03-18 06:02:05 +00:00
Yuya Nishihara
be4cb847fa repo: unblock loading of simple backend
This removes warning about unused SimpleBackend on non-dev build. Since
Workspace::init_simple() isn't feature-gated, it doesn't make sense to disable
the backend loading.
2025-03-18 05:37:12 +00:00
Baltasar Dinis
837eee90be git: add more targetted debug logging for subprocess code
In recent bugs, it's been really hard to triage the behaviour from the
existing debug logs.

In particular, there have been situations where the `git` command is not
enough to triage, because the bug stems from a particular
environment/config issue. Moreover, these bugs are either transient, and
as such hard to replicate, or they only manifest when spawning `git`
from `jj` (and as such re-running the `git` command does not yield
useful information).

In those cases, seeing what the subprocessing code is seeing becomes
very much useful. This commit adds some debug logging to help with this
problem, by logging some parts of the `git(1)` output and the config.
2025-03-18 03:27:05 +00:00
Emily
d9c3ffa022 github: revert the timeout to 15 minutes 2025-03-18 02:22:47 +00:00
Emily
3ad42b8f15 github: use faster linkers in CI
This shaves off something like 20 to 40 seconds for Linux. It’s
seemingly within the margin of error for Windows, so not sure if
we’ll want to keep it there.
2025-03-18 02:22:47 +00:00
Emily
5d48339165 github: only pass --target to Cargo when necessary 2025-03-18 02:22:47 +00:00
Emily
acd8ecf9f2 github: move CARGO_* CI variables into Cargo configuration
`incremental` is unnecessary since the `rust-toolchain` action
already sets the environment variable, but probably harmless for
future‐proofing.
2025-03-18 02:22:47 +00:00
Emily
608ce2de55 cargo: move config{=> -ci}.toml
This configuration is for the CI builders, so by moving it to another
file we can add more opinionated things without risking breaking
builds for anyone else.
2025-03-18 02:22:47 +00:00
Ilya Grigoriev
341ddc9148 ci: make sure tests fail in CI if gpg or taplo binaries are not found
Fixes #5696
2025-03-18 02:18:08 +00:00
Yuya Nishihara
b000c94a7a tests: add work_dir.dir(path), make create_dir*() return helper for sub dir
I found this pattern is common.
2025-03-18 01:25:08 +00:00
Yuya Nishihara
c7811bb956 tests: move strip_last_line() to command_output module
The primary caller of this function is CommandOutputString. We can reexport it
if needed.
2025-03-18 01:25:08 +00:00
Yuya Nishihara
7ab62ab865 tests: extract CommandOutput types to sub module
These types don't depend on TestEnvironment.
2025-03-18 01:25:08 +00:00
Yuya Nishihara
c63d8d945e tests: do not mark SSH private key as executable
It doesn't matter, but the intent here should be "chmod go-rwx".
2025-03-18 01:24:47 +00:00
Johannes Altmanninger
4c01ed0746 docs: fish shell enables completions by default
To avoid redundant computation, users who run `COMPLETE=fish jj | source`
in their ~/.config/fish/config.fish should eventually remove that, or move it
to ~/.config/fish/completions/jj.fish which overrides the default completions.

Ref: https://github.com/fish-shell/fish-shell/pull/11046
2025-03-17 18:37:48 +00:00
Philip Metzger
f8ab8a0e72 lib: rename the LocalBackend to SimpleBackend
This makes it clear to source code readers, that it isn't the _native backend_ the project
talks about in the Roadmap.
2025-03-17 17:17:11 +00:00
Emily
76bff8fa34 github: set LIBGIT2_NO_VENDOR on builds as well
This was causing unnecessary rebuilds in the test step due to the
changed environment variable.
2025-03-17 17:10:11 +00:00
Emily
758e35eef1 github: don’t install Gpg4win on Windows
The stock version seems to be sufficient these days.
2025-03-17 17:10:11 +00:00
Emily
eb39c4175a github: don’t reinstall OpenSSH on Windows
The stock version seems to be sufficient these days.
2025-03-17 17:10:11 +00:00
Benjamin Tan
2bf5d6aa8f cli: deprecate backout command 2025-03-17 15:03:29 +00:00
Benjamin Tan
8a816b2622 cli: add revert command
This adds a revert command which is similar to backout, but adds the
`--destination`, `--insert-after`, and `--insert-before` optoins to
customize the location of the new reverted commits.

`jj backout` will subsequently be deprecated.

Closes #5688.
2025-03-17 15:03:29 +00:00
Yuya Nishihara
ec6c5235d5 annotate: report root commit id if no origin found within range
Suppose we add "jj file annotate" option to specify the search domain or depth,
the root commit within the range can be displayed as the boundary commit. "git
blame" for example displays boundary commits with ^ prefix.

This follows up 85e0a8b0687e "annotate: add option to not search all ancestors
of starting commit."
2025-03-17 10:57:33 +00:00
Yuya Nishihara
789249541e cargo: remove "anyhow" which was used only in config tests
It's not important to remove anyhow dependency, but there was no reason to use
anyhow.
2025-03-17 01:39:55 +00:00
Yuya Nishihara
dd0e4f8f66 tests: define config TestCase types early
I feel it's easier to follow if types are defined first.
2025-03-17 01:39:55 +00:00
Yuya Nishihara
93aa697ca1 tests: remove redundant .to_path_buf() from test_config_path() 2025-03-17 01:39:55 +00:00
Yuya Nishihara
0e32223d9a tests: inline config TestCase::run() into test function, use assert!()s
We generally use panicking functions in tests.
2025-03-17 01:39:55 +00:00
Yuya Nishihara
27c777b3e5 tests: reorganize config TestCase as parameterized test_case
The TestCase type will be a pure value type.
2025-03-17 01:39:55 +00:00
Yuya Nishihara
cdc2ddf822 tests: remove generic parameters from config TestCase
We don't care about the memory layout here, and it'll become verbose to spell
them out in the following patches.
2025-03-17 01:39:55 +00:00
Jonathan Gilchrist
153c972822 diff-editor: Always use Section::FileMode when creating or deleting files
The code in this area gets significantly simpler, since there's no
longer any ambiguity to resolve. The scm-record changes expect that any
mode changes are represented by file mode sections, and adds UI hooks to
simplify working with them (e.g. automatically de-selecting a deletion
mode change if any lines in the file are de-selected, since the file
still needs to exist to hold those lines).

If the user selects a file mode change, the new mode comes back as part
of .get_selected_contents(), so we can use this directly to figure out
whether the file was removed or just changed.
2025-03-16 18:18:46 +00:00
David Rieber
7e1901fefa jj fix: Refactor jj fix CLI, move some logic to lib to make it usable in other tools (e.g. in servers).
* The lib part should not deal with tools, or tool config, or running stuff in subprocesses. That stays in the CLI.
* Adds a fix_files function. This is the entry point.
* Adds a FileFixer trait with a single method to process a set of files. This is a high-level plugin point.
* Adds a ParallelFileFixer which implements the FileFixer trait and invokes a function to fix one file a time, in parallel.
* The CLI uses ParallelFileFixer.

The FileFixer trait allows environments (other than jj CLI) to plug in their own implementation; for example, a server could implement a FileFixer that sends RPCs to a "formatting service".
2025-03-16 17:59:22 +00:00
Emily
8bb6b90478 github: add variant without git2 to CI
Just using the fastest platform should be fine for this. Hopefully it
shouldn’t slow down CI too much since it’s an independent build
job and only temporary, though a potential alternative would be to
just check the build instead. (It wouldn’t catch build regressions
in the test code, though.)
2025-03-16 06:07:28 +00:00
Emily
cce229d914 config: warn on unsupported git.subprocess = false 2025-03-16 06:07:28 +00:00
Emily
a56b78bdb6 git: make git2 support optional
This helps us prepare for removing the functionality down the line and
makes things easier for people building or packaging their own Jujutsu.
2025-03-16 06:07:28 +00:00
Emily
8f51e749d0 git: inline open_git_repo
The fetch and push code are the only remaining users of this, so
let’s not encourage adding any more.
2025-03-16 06:07:28 +00:00
Ilya Grigoriev
d1c2a1c578 config docs: touch up platform-specific config location docs 2025-03-16 04:14:15 +00:00