8712 Commits

Author SHA1 Message Date
Yuya Nishihara
67a2f41b80 ui: make prompt_choice() return index of choices
It's easier to process index than re-parsing stringified choice.
2025-03-15 06:29:01 +00:00
Yuya Nishihara
efabaa48b2 cli: print list of next/prev candidates to stderr
Follows up 0c7357ec5f55 "ui: write prompt messages to stderr."

I also removed &mut since writing to Ui doesn't require mutable reference.
2025-03-15 06:29:01 +00:00
Martin von Zweigbergk
162e455390 tree: delete unused code for merging legacy trees
This code has been unused since 8e6e04b92.

I also deleted the associated tests. I considered porting them to
`MergedTree` but it looks like we have good coverage of these cases in
the existing `MergedTree` tests combined with the low-level `Merge`
tests.
2025-03-15 05:18:43 +00:00
Emily
09d6d48718 github: fix ci workflow concurrency setting in the queue 2025-03-15 03:25:25 +00:00
Yuya Nishihara
aeb80d2ce7 tests: port test_diffedit_command.rs to TestWorkDir API 2025-03-15 02:41:22 +00:00
Yuya Nishihara
31620a11ae tests: port test_diff_command.rs to TestWorkDir API 2025-03-15 02:41:22 +00:00
Yuya Nishihara
fc84c639f7 tests: configure fake editor early in test_diff*_command.rs
This works around borrowing issue of test_env.
2025-03-15 02:41:22 +00:00
Yuya Nishihara
717f02a97f tests: port test_describe_command.rs to TestWorkDir API 2025-03-15 02:41:22 +00:00
Yuya Nishihara
5b13043167 tests: configure fake editor early in test_describe_command.rs
This works around borrowing issue of test_env.
2025-03-15 02:41:22 +00:00
Yuya Nishihara
f8082a052d templates: do not apply "overridden" label twice to detailed config list 2025-03-15 01:51:47 +00:00
Yuya Nishihara
d9c58446e8 templates: rename inner "config list" helper to format_*()
This is our convention, and helper functions can be hidden from the builtin
aliases list.
2025-03-15 01:51:47 +00:00
Yuya Nishihara
d79b93707c config: minor cleanup around new path/source template handling
Cow<str> provides .into_owned(). I don't care much about .to_string() vs
.to_owned(), but it was originally .to_owned(), so reverted the change.
2025-03-15 01:51:47 +00:00
Yuya Nishihara
ee89fd34a3 tests: port test_config_list_origin() to TestWorkDir API 2025-03-15 01:51:47 +00:00
Martin von Zweigbergk
9b76f05d65 cargo: update to pollster 0.4
I just happened to see that there's a new(ish) version out. It removed
all unsafe code, apparently.
2025-03-14 20:32:18 +00:00
dependabot[bot]
72513fd377 cargo: bump the cargo-dependencies group across 1 directory with 3 updates
Bumps the cargo-dependencies group with 3 updates in the / directory: [once_cell](https://github.com/matklad/once_cell), [tempfile](https://github.com/Stebalien/tempfile) and [tokio](https://github.com/tokio-rs/tokio).


Updates `once_cell` from 1.21.0 to 1.21.1
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.21.0...v1.21.1)

Updates `tempfile` from 3.18.0 to 3.19.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.18.0...v3.19.0)

Updates `tokio` from 1.44.0 to 1.44.1
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.44.0...tokio-1.44.1)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-14 18:46:32 +00:00
Yuya Nishihara
b24c4eb758 cli: use RemoteRefSymbol to format trackable bookmarks 2025-03-14 15:40:58 +00:00
Yuya Nishihara
caa0e75936 cli: move print_trackable_remote_bookmarks() back to git/init.rs
We no longer have external callers of git_init() functions.
2025-03-14 15:40:58 +00:00
Yuya Nishihara
896424db76 templater: rename RefName type to CommitRef
I'm thinking of adding RefName(str) and RemoteName(str) newtypes, and the
templater type name would conflict with that. Since the templater RefName type
is basically a (name, target) pair, I think it should be called a "Ref", and I
added "Commit" prefix for disambiguation.

This isn't a breaking change since template type names only appear in docs and
error messages.
2025-03-14 14:58:29 +00:00
Jakob Hellermann
1f751e28cc templates: expose format_short_signature_oneline template alias hook
For `builtin_log_compact` you can specify how you want signatures to be
displayed via `format_short_signature`, but the same wasn't possible for
`builtin_log_compact_oneline` which always chose `email().local()`.
2025-03-14 13:50:51 +00:00
Baltasar Dinis
4e5260dad2 git: detect remote refusal of a push
When we push a ref to a git remote, we use --force-with-lease
Our understanding was that this could fail iff the expected location of
the ref on the remote was not that of the local tracking ref

However, if the ref is from a protected branch (e.g., main) it will be
rejected by the remote for a different reason.

This commit solves this, by detecting this difference.
2025-03-14 08:09:37 +00:00
Baltasar Dinis
bb75612d00 git: small fixes to git-push parsing
Mainly, the reason is not separated by a tab, but rather a space
Additionally, the test output was made more realistic
2025-03-14 08:09:37 +00:00
Baltasar Dinis
6c95f6192f git: refactor git push output 2025-03-14 08:09:37 +00:00
Caleb White
67e17d5474 cli: config list: show origin of config values
Adds a `templates.config.list` config option to control whether the
detailed list is shown or not.

The `builtin_config_list_detailed` template adds the config origin to
the end of the line for each config value in the list. Options coming
from files will show the file path.
2025-03-13 23:59:45 +00:00
Emily
47cd10669d github: only run dependabot workflow on dependabot/** branches
I think this will reduce some noise from skipped checks in the UI.
2025-03-13 22:28:05 +00:00
Emily
81aad08bc3 Back out "github: don’t use auto‐merges for dependabot"
It turns out that merge queues bundle auto‐merge for free, so we
can just do this the old way.

This backs out commit eba4257ab9a0268460108c234dc0d046efcd6c33.
2025-03-13 22:28:05 +00:00
Emily
117c262086 github: set fail-fast for merge queue jobs
Ideally we’d just cancel workflows entirely when they’re ejected
from the merge queue but apparently that’s kinda hard for some
inexplicable reason. This should be a cheap and harmless win. I
guess it gives you slightly less information if something fails
because of changes in the queue but you can just rebase your PR to
get everything running.
2025-03-13 18:36:24 +00:00
Emily
cd1125467d github: adjust ci concurrency settings
I don’t think `github.event.merge_queue.head_ref` actually does
anything useful, but I’m not sure if `github.ref` works for merge
groups and it seems better to have a fallback than not. I’d really
like to cancel PR workflows when a PR enters the merge queue, and
cancel queue workflows when a PR is ejected from the merge queue,
but apparently this simple task is high‐level wizardry when you’re
using GitHub Actions, so I’m postponing that for later.
2025-03-13 18:36:24 +00:00
Emily
968fcc0b0c github: remove push trigger from ci
This was running all the checks twice for pushes to pull requests,
unnecessarily limiting our concurrency and clogging up the status
report. The only benefit is if someone is pushing to a branch that
they don’t have a PR for and waiting for the checks to run. I
suspect nobody is doing this with regularity, but if it turns out
the functionality is important, we could just ask people to add this
back to the `.github/workflows/ci.yml` on the branches they want
GitHub to test, or add logic to try and cancel `push` runs that match
`pull_request` ones.
2025-03-13 18:36:24 +00:00
Yuya Nishihara
81f8ae42d6 tests: port test_debug_command.rs to TestWorkDir API 2025-03-13 16:13:12 +00:00
Yuya Nishihara
8520557aaa tests: port test_copy_detection.rs to TestWorkDir API 2025-03-13 16:13:12 +00:00
Yuya Nishihara
e35da6988c tests: port test_config_command.rs to TestWorkDir API
Some setup bits are reordered manually to work around mutable borrows.
2025-03-13 16:13:12 +00:00
Yuya Nishihara
dd00489235 tests: port test_concurrent_operations.rs to TestWorkDir API 2025-03-13 16:13:12 +00:00
Yuya Nishihara
334c9e184e tests: port test_completion.rs to TestWorkDir API 2025-03-13 16:13:12 +00:00
Yuya Nishihara
1ba5af082f config: externalize ConfigPath::Unavailable variant
We're going to add support for multiple user config paths, and it would be
weird if Unavailable could be included in a Vec.
2025-03-13 15:38:40 +00:00
Caleb White
7e944f0d11 cli: config {edit,set,unset}: prompt when multiple files exist
This allows the user to select a particular file when using multiple
configs. In the event that a prompt cannot be displayed, the first
file will be automatically selected.
2025-03-13 03:51:52 +00:00
Yuya Nishihara
4ff6150df7 tests: port test_commit_template.rs to TestWorkDir API
std::fs::rename() and symlink() aren't added to TestWorkDir. There are few
instances of rename(). work_dir.symlink() would be a bit unclear whether the
link content path is normalized, which usually shouldn't.
2025-03-13 03:45:45 +00:00
Yuya Nishihara
55eeac9ddd tests: port test_commit_command.rs to TestWorkDir API 2025-03-13 03:45:45 +00:00
Yuya Nishihara
86beeea50c tests: configure fake editor early in test_commit_command.rs
This works around borrowing issue of test_env.
2025-03-13 03:45:45 +00:00
Yuya Nishihara
c07db5a4d8 tests: port test_builtin_aliases.rs to TestWorkDir API
The local work_dir is created by caller since it borrows &test_env.
2025-03-13 03:45:45 +00:00
dependabot[bot]
8edfcf3e88 cargo: bump quote from 1.0.39 to 1.0.40 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [quote](https://github.com/dtolnay/quote).


Updates `quote` from 1.0.39 to 1.0.40
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.39...1.0.40)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 02:19:07 +00:00
Emily
228385f7f4 github: attempt to fix required-checks 2025-03-12 20:23:45 +00:00
Emily
725139dd38 github: add required-checks job to ci
This reports the status of the checks that are currently set as
required in the repository configuration, but only in the merge
queue. The advantages are twofold:

1. We can adjust required checks with our normal CI process rather
   than having to bug Martin for it. (This doesn’t really place any
   more trust in anyone than we do currently, because a malicious PR
   could always just replace the jobs with ones that unconditionally
   succeed anyway.)

2. We can make the job only ever fail in the merge queue. Currently,
   we can only submit a PR into the merge queue after all its checks
   pass. Those checks then immediately get run again in the merge
   queue. If you do one final fix‐up to an approved PR, it takes
   half an hour after that to merge instead of fifteen minutes. We
   make this less painful by using auto‐merges, but it’s silly
   to block on the PR checks when the actual guarantees are provided
   by the merge queue.

   Unfortunately GitHub demands the same jobs be required for putting
   something into the merge queue and taking it out. We can work
   around this by only requiring the `required-checks` job and having
   it report its status depending on the context.

Tasks for Martin:

1. Go to <https://github.com/jj-vcs/jj/settings> and disable “Allow
   auto-merge”. This would now only block on PR approval / discussion
   resolution, so it’s probably more confusing than helpful; I’ve
   hit the button and then come back an hour later to discover that
   I forgot to resolve discussions.

   Go to <https://github.com/jj-vcs/jj/settings/rules/3400426> and
   replace all of the required GitHub Actions checks under “Require
   status checks to pass” with the single `required-checks` check.

3. While you’re at it, go to
   <https://github.com/jj-vcs/jj/settings/actions> and ensure that
   “Workflow permissions” is set to “Read repository contents
   and packages permissions”. We already handle this correctly in
   all our workflows but the default is to allow write permissions
   for legacy reasons.
2025-03-12 18:15:50 +00:00
Emily
eba4257ab9 github: don’t use auto‐merges for dependabot
Since we no longer want auto‐merge in general.
2025-03-12 17:41:55 +00:00
Emily
c8477b78f4 github: simplify dependabot concurrency settings 2025-03-12 17:41:55 +00:00
Emily
6674ae7e96 github: don’t run dependabot workflow in the merge queue
This is totally pointless I think, since the point of the workflow
is to queue things in the first place.
2025-03-12 17:41:55 +00:00
Joachim Desroches
67ffbfa14f cli: annotate: do not panic on reaching initial commit.
As described in #5909, in the case where jj was initialized in a
shallowly cloned repository which was then unshallow'd, jj does not
import the fetched commits that were outside the shallow boundary.

However, it does import the ones after the boundary, which after
unshallowing do not contain the changes made before the boundary.

Therefore, when running annotate in such a case, jj would panic because
it does not find the commit from which a line originates. This sets the
empty commit as carrying the blame for that line.
2025-03-12 13:45:57 +00:00
Yuya Nishihara
dcf4771a07 cli: emit warning for deprecated diff.format, move default to config/misc.toml
The old name "diff.format" has been deprecated since 0.7.0, but there was no
deprecation warning.
2025-03-12 13:42:41 +00:00
Benjamin Tan
d928ef6f96 cli_util: compute_commit_location: return CommitId instead of Commit
Not all callers of `compute_commit_location` require the full `Commit`
struct.
2025-03-12 10:12:05 +00:00
Benjamin Tan
3f78de300b cli_util: WorkspaceCommandHelper::resolve_some_revsets_default_single: return CommitId instead of Commit 2025-03-12 10:12:05 +00:00
Yuya Nishihara
902ef9fce3 diff: fix inconsistent handling of "short" format arguments
All "short" formats should be able to be combined with -p/--patch. It was also
weird that "short" diff stats followed "long" color-words/git diffs.

Fixes #5986
2025-03-12 04:32:01 +00:00