Commit graph

10412 commits

Author SHA1 Message Date
Scott Taylor
eda0621d13 bookmark move: default --from revset to closest_bookmarks(to)
A common recommendation for new users is for them to add a `jj tug`
alias. This change makes that alias less necessary, since a command like
`jj bookmark move --to @-` can be used instead for most cases. We could
also potentially improve this further by changing the default revset for
`--to`, but that can be a separate discussion.

The `closest_bookmarks(to)` revset is inspired by the discussion in
https://github.com/jj-vcs/jj/discussions/5568#discussioncomment-12674748.
I think it makes sense for it to be plural though, since it is allowed
for it to return multiple bookmarks.
2025-12-17 20:42:09 -06:00
Yuya Nishihara
ad5ae40b04 cli: gerrit: remove excessive newlines and "warning:" prefix, respect --quiet
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
It seemed weird that the test snapshots had random blank lines.
2025-12-18 00:13:25 +00:00
Yuya Nishihara
f059bc4017 cli: gerrit: avoid loading parent commit objects needlessly 2025-12-18 00:13:25 +00:00
Thomas Castiglione
66d04235c6 watchman: don't start a new tokio runtime if there already is one
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
LockedWorkingCopy::snapshot() is already async, so this is just a matter of changing TreeState::snapshot() and making the runtime conditional
2025-12-17 17:31:07 +00:00
Yuya Nishihara
3f6c2c1e2e stacked_table: add gc() function to prune unreachable table segments
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This is an easy part of Git extra table GC. The implementation is quite similar
to SimpleOpStore::gc(). Since we don't delete unreachable "commit" entries from
the table segments, this wouldn't improve runtime performance. Directory lookup
might get slightly faster thanks to fewer file entries, though.

#12, #8312
2025-12-17 10:38:11 +00:00
Yuya Nishihara
e0a725736d cli: add debug command that dumps stats of stacked table
This is pretty low level, but we can at least know which extras table files are
active. The --key-size parameter doesn't matter so long as it is smaller than
the actual key size, but we might add sanity check later.
2025-12-17 10:38:11 +00:00
Scott Taylor
dc325cbdb2 complete: include offset in completions for divergent changes
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-17 02:12:55 +00:00
Jonathan Hoelzel
537dbc04ea docs: Add myself as paid contributor (under IMC Trading)
The prior commit in this PR was done of my own accord but during work
hours, so adding myself to this list.
2025-12-17 00:30:17 +00:00
Jonathan Hoelzel
69477cd465 gerrit: handle mixed explicit & implicit Change-Ids in upload
The 'gerrit upload' cli command is meant to support uploading commits
that have an explicit "Change-Id: ..." footer, and those that don't. In
the latter case, a temporary copy of the commit being uploaded will be
created, with the Change-Id set based on the jj change id.

Prior to this commit, there was a bug in this implementation when a
chain of commits contained some with Change-Id footers and some without.

Say we have commits a->b->c, where b has no Change-Id footer but c does
(this case is what's now tested in the test_gerrit_upload_local case).

The old logic would:
- create a new version of b (let's call it b*), with a CommitId footer,
  and populate the 'old_to_new' map with 'b -> b*'
- not create a new version of c, and populate the 'old_to_new' map with
  'c -> c'
- push the 'new' version of c, which is c itself. However, c has b as a
  parent, not b*, so this fails to send to gerrit because b has no
  Commit-Id footer!

After this commit, we create a new temporary commit if either the
description is changed (as before), or if any parents are different from
the original commit's parents. This does not change the behavior for
either the all-explicit or all-implicit ChangeId cases, but fixes the
behavior in this mixed case.
2025-12-17 00:30:17 +00:00
Jonathan Hoelzel
ea5f23d3ce gerrit: add test for all-explicit change-ids for upload command
The 'gerrit upload' command has logic to handle commits with the
"Change-Id" explicitly set within the commit message, and commits
without the Change-Id explicitly set. This commit adds a test for the
behavior when all commits have the Change-Id explicitly set.

Also fix typo in existing test comment
2025-12-17 00:30:17 +00:00
Steve Klabnik
ead7a16427 docs: remove non-functional xonsh completion instructions
Related to #8141
2025-12-16 22:02:02 +00:00
dependabot[bot]
e4841aca9b 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) | `5.0.0` | `6.0.0` |
| [taiki-e/install-action](https://github.com/taiki-e/install-action) | `2.62.63` | `2.63.3` |
| [cachix/install-nix-action](https://github.com/cachix/install-nix-action) | `31.8.4` | `31.9.0` |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `7.1.5` | `7.1.6` |
| [github/codeql-action](https://github.com/github/codeql-action) | `4.31.7` | `4.31.8` |


Updates `actions/upload-artifact` from 5.0.0 to 6.0.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](330a01c490...b7c566a772)

Updates `taiki-e/install-action` from 2.62.63 to 2.63.3
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](50708e9ba8...d850aa8169)

Updates `cachix/install-nix-action` from 31.8.4 to 31.9.0
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Changelog](https://github.com/cachix/install-nix-action/blob/master/RELEASE.md)
- [Commits](0b0e072294...4e002c8ec8)

Updates `astral-sh/setup-uv` from 7.1.5 to 7.1.6
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](ed21f2f24f...681c641aba)

Updates `github/codeql-action` from 4.31.7 to 4.31.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](cf1bb45a27...1b168cd394)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
- dependency-name: taiki-e/install-action
  dependency-version: 2.63.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
- dependency-name: cachix/install-nix-action
  dependency-version: 31.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 20:01:22 +00:00
Shnatu
4a3c56ef4c paid_contributors: Add kiranani (snatu@google.com) 2025-12-16 20:01:11 +00:00
Scott Taylor
40637b294a default_index: sort resolve_change_id_prefix() by descending position
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-16 14:27:11 +00:00
Scott Taylor
1fb5a9656b command_error: use offset in hint for divergent changes
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
It's usually going to be easier for a user to run the same command again
but with a change offset appended, so I think these are more helpful
than commit IDs.
2025-12-16 02:02:31 +00:00
Scott Taylor
edc578c56b docs: update examples of divergence to include change offsets 2025-12-16 02:02:31 +00:00
Scott Taylor
0dffb6f108 templates: show change offsets for divergent and hidden commits
For now, I just replaced `??` with the change offset for divergent
commits. We can add an explicit "divergent" label later.
2025-12-16 02:02:31 +00:00
Scott Taylor
9be4bcc506 commit_templater: add change_offset() to Commit 2025-12-16 02:02:31 +00:00
Scott Taylor
5df15f60c6 revset: parse change IDs with offset like xyz/2 2025-12-16 02:02:31 +00:00
Scott Taylor
7fd50edc65 index: add ResolvedChangeTargets to return all commits with change ID
I'm going to add a way to select a specific commit from the set of
commits with a given change ID. We could sort these by committer
timestamp or something else, but index position is convenient because it
doesn't require reading the commits. The exact order isn't too
important, but giving newer commits lower offset numbers is nice because
newer commits are used more frequently.
2025-12-16 02:02:31 +00:00
Steve Klabnik
cfa09ac9c8 docs: remove misleading "See also List type" from ListTemplate
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This cross-reference was added in 998727266c (March 2023) when
ListTemplate was first documented. At that time, List only had two
methods: .join() and .map(). The reference made some sense since
ListTemplate was the result type of .map() and shared the .join()
method.

However, List has since grown significantly with .len(), .filter(),
.any(), .all(), and Boolean conversion - none of which ListTemplate
supports. ListTemplate still only has .join(). This makes the
cross-reference misleading, as it implies a compatibility that
doesn't exist (unlike List<Trailer> which truly extends List).

Fixes #7951
2025-12-15 17:22:24 +00:00
Yuya Nishihara
b9317da0f8 cli: enable glob string matching globally
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
The goal of this change is to unify defaults of string patterns in revsets and
command arguments. Glob is a good default because it's largely the same as exact
matching, and we can easily express substring patterns with globs.

The hint for "jj git fetch -b<glob>" is deleted since exact:<glob> is now
required in order to trigger the error.

This patch also updates help of clone/fetch --branch patterns. Glob and operator
support in refspecs is limited.
2025-12-15 04:27:32 +00:00
Yuya Nishihara
8765e92eca cli: update one missed hint about "bookmark untrack glob:{name}@*"
This should have been made by f4dc07eb3c.
2025-12-15 04:27:32 +00:00
Yuya Nishihara
97375fa041 revset: enable glob string matching by default
Follows up c93682f2 "revset: parameterize default string pattern kind, add
config knob".
2025-12-15 04:27:32 +00:00
Steve Klabnik
c969da4b55 docs: clarify what happens to unselected changes in jj commit
When using `--interactive` or path arguments, it wasn't clear from the
help text what happens to the changes that aren't selected. This adds
an explanation to the main command documentation and updates the flag
and argument descriptions to use "current commit" instead.

Fixes #6666
2025-12-15 04:00:05 +00:00
Anton Älgmyr
840ae9ebf4 templates: Expose conflicted files in the template language
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-14 17:11:16 +00:00
Stephen Jennings
4981e364e7 docs: Add document explaining CLI flags 2025-12-14 15:40:56 +00:00
Shaoxuan (Max) Yuan
36d1a2a72d colocation: use gix for toggling core.bare config
Some checks failed
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Instead of forking a git process, use `gix` to toggle `core.bare` config.

The original `git -C <repo_root>/.jj/repo/store/git config repo.bare
<true|false>` fails when the user has `safe.bareRepository` config set to
'explicit'. A typical failure looks like this:

	% jj git colocation disable
	Error: Failed to set core.bare to true in Git config.
	Caused by: Git config failed: fatal: not in a git directory

.git is moved to .jj/repo/store/git as a bare repo, and if we run git directly:
	
	% git -C .jj/repo/store/git config repo.bare true
	fatal: not in a git directory

	% git -C .jj/repo/store/git status
	fatal: cannot use bare repository
	<repo_root>/.jj/repo/store/git (safe.bareRepository is 'explicit')

Use `gix` to avoid forking git and being interferred by git's configs.
2025-12-13 04:28:31 +00:00
Yuya Nishihara
051a1e5343 cli: complete: omit @remote part from bookmarks to track/untrack 2025-12-13 01:32:49 +00:00
Yuya Nishihara
f4dc07eb3c cli: update hints to use new "track/untrack --remote" syntax 2025-12-13 01:32:49 +00:00
Yuya Nishihara
e921791574 cli: bookmark: add --remote argument to track/untrack, deprecate name@remote
These two are the last commands which don't support logical operators in string
patterns. The old <kind>:<name>@<remote> syntax had various problems including:

 1. substring patterns look weird (e.g. `substring:x@y` means `*x*@*y*`)
 2. cannot express "all but <name> for all remotes" (e.g. `(~gh-pages)@(*)`)

In addition to that, the revset parser doesn't support `<name>@<remote>`
prefixed by `<kind>:`.

This patch introduces separate --remote argument to address these problems. The
default is `glob:*` (or `~git`), so we wouldn't have to specify the remote in
many cases. One caveat is that `jj bookmark track` is not idempotent if there
are multiple remotes:

    # there are two remotes: origin and upstream,
    # and only foo@origin exists
    $ jj bookmark track foo
    # tracks foo@origin and creates new local bookmark foo
    $ jj bookmark track foo
    # tracks absent foo@upstream as we now have a local bookmark

This is wild. We might want to add a flag or a new command to track absent
remote bookmarks to push.

"Unmatched names" warnings are now emitted for bookmark and remote names
separately. To keep the implementation simple, the search space isn't restricted
by the other parameter. For example, "jj bookmark track foo --remote=bar" won't
show a warning if "foo" exists locally or in any remote.

Closes #4260
2025-12-13 01:32:49 +00:00
Yuya Nishihara
410bb2a69f cli: extract filter function from find_trackable_remote_bookmarks() 2025-12-13 01:32:49 +00:00
xtqqczze
9b2c4cace8 rustc_lint: unused_variables lint with --no-default-features
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-13 01:04:03 +00:00
Yuya Nishihara
2f9041b842 diff: reduce intensity of context line numbers in color-words diffs
This will help notice small hunks in inlined diff lines. Not all terminals would
support "dim" attribute, but I think that's okay since the diff output should be
readable with/without this change.

Closes #5140
2025-12-13 00:56:55 +00:00
Yuya Nishihara
2ff13a9aae formatter: add support for "dim" attribute
Handling of dim and bold is a bit complicated because these two attributes
cannot be unset individually. I think NormalIntensity will work for resetting
both bold and dim, but I don't have expertise on terminal implementations. So
this patch applies the same workaround as bold to dim.
2025-12-13 00:56:55 +00:00
Steve Klabnik
c8b89ad516 docs: improve profiling documentation
Fixes #1941

I'm including this in the contributing.md rather than in docs/technical because
it's not particularly long, and there's already some information there.
2025-12-12 17:27:10 +00:00
Yuya Nishihara
fa142f7c3e git: peel old tags when exporting refs
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
move_git_ref() has to do .reference() twice because we don't know oid of the old
tag object. Other than that, the change is straightforward.
2025-12-12 10:00:38 +00:00
Yuya Nishihara
2f0b0c68e5 git: use gix::ObjectId types in peeling function
We'll reuse resolve_git_ref_to_commit_id() to fix export functions.
2025-12-12 10:00:38 +00:00
Yuya Nishihara
0efe1e838c tests: include annotated tags, creation, deletion in git::export_refs() test
git::export_refs() fails to update annotated tags right now.
2025-12-12 10:00:38 +00:00
Scott Taylor
9b9bdd009d conflicts: propagate conflict labels down to materialization functions
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-12-12 04:29:59 +00:00
Scott Taylor
504455f18a merge: add Diff::zip method
Also adds tests for other methods since they were missing tests.
2025-12-12 04:29:59 +00:00
Scott Taylor
78bfda9d1b local_working_copy: re-materialize conflicts if labels changed 2025-12-12 04:29:59 +00:00
Scott Taylor
34c471af3f merged_tree: add conflicts_matching() method 2025-12-12 04:29:59 +00:00
David Higgs
a1fd576e85 tests: exercise retagging the same commit 2025-12-12 02:55:55 +00:00
David Higgs
5128c2e0df tests: exercise unsigning triggering rebasing 2025-12-12 02:55:55 +00:00
David Higgs
d67fe32470 tests: exercise signing and unsigning nothing 2025-12-12 02:55:55 +00:00
David Higgs
4d066cd1bd tests: exercise sparse edit with invalid path 2025-12-12 02:55:55 +00:00
David Higgs
23496ffa65 tests: exercise util install-man-pages 2025-12-12 02:55:55 +00:00
David Higgs
29979e0c32 tests: exercise util exec when the program crashes 2025-12-12 02:55:55 +00:00
David Higgs
349bca031b tests: exercise util completion with elvish and powershell 2025-12-12 02:55:55 +00:00