Commit graph

10315 commits

Author SHA1 Message Date
Tommi Virtanen
185c65482b docs: GitBackend uses gitoxide not git2
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
See #5548 for git2 deprecation.
2025-12-03 05:55:42 +00:00
Matt Stark
668a034e08 working-copy: Ensure sub-repos are not tracked.
If a submodule was created in a commit C on a remote repo, switching from any
commit after C to any commit before C (eg. `jj new C-`) will result in jj
starting to track the files introduced in the submodule.

This issue has popped up very frequently for chromium developers, who
get issues when attempting to check out an older version of chromium.

Fixes #4349
2025-12-02 23:20:34 +00:00
Philip Metzger
ae0ff17c25 docs: delete a dead TODO and sort some links
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
Delete the dead reference to bwb's cultivate which no longer is actively worked on since
in the mean time ersc was founded. Also sort the links in the doc.
2025-12-02 21:23:14 +00:00
Martin von Zweigbergk
d4f0859a9e working_copy: determine staleness by comparing op id instead of tree id
Our detection of stale working copy is based on the tree id since a
long time ago, at least since Feb 2022 (e098c01935) depending on how
you count. Since Sep 2022 (443e73f346), we keep the last operation
recorded in the working copy up to date. However, we don't update it
when the tree id matches. That's inconsistent, so I think we should
always keep it up to date. This patch fixes that.

Thanks to @kevincliao for spotting this. We noticed this at Google
because it meant that we sometimes didn't notice the new operation id
in our distributed file system, which led to the machine creating
divergent operations.  (The machine is supposed to detect operations
recorded in the operation log but this is sometimes flaky for
unrelated reasons.)
2025-12-02 16:48:10 +00:00
Martin von Zweigbergk
5443475ea9 cli: test stale working copy with unpublished op and same tree
This adds a test case of a scenario we sometimes run into at Google
with our distributed file system. It can happen that two machines
accessing the distributed file system do the same snapshotting but one
machine doesn't see the other one's operation due to cache
invalidation bugs.
2025-12-02 16:48:10 +00:00
Martin von Zweigbergk
929cb60a3d cli_util: extract a function for handling stale working
The code in `snapshot_working_copy()` was getting long and I'm about
to add more of it.
2025-12-02 16:48:10 +00:00
Yuya Nishihara
dd41f0ea08 conflicts: wrap materialized diff values in Diff<T>
Since the original values are of Diff<MergedTreeValue> type, the materialized
version should also be Diff<T>.
2025-12-02 14:52:28 +00:00
Velociraptor115
c1b7a6ea52 template: Add support for per-file diff stats
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 primary benefit of this change is that it splits
"lines_added()" and "lines_removed()" into separate fields,
which will be useful for tools.

Many tools use "status()", "lines_added()", "lines_removed()",
"source()" and "target()" to show useful information about
every file modified in a commit.

The existing diff stats summary shows only the combined 
number of lines modified, along with a "percentage" representation
of line additions vs. deletions. This is lossy and not
useful for tools, since it is impossible to arrive at
the exact number of lines added and deleted.
2025-12-02 12:59:00 +00:00
Velociraptor115
2db1fc85b7 diff_util: Add DiffEntryStatus enum and refactor relevant code
This is in preparation for supporting status in per-file diff stats.
2025-12-02 12:59:00 +00:00
Fedor
c7078f9dd1 cli: fix workspace update-stale in colocated repos
The reload-to-HEAD logic added in 7a296ca1 to fix a race condition was
breaking "workspace update-stale" by reloading the repo to HEAD before
snapshotting, even though recovery intentionally loads at an old
operation.

Fix by adding a flag that skips the reload when recovering from a stale
working copy.
2025-12-02 11:43:42 +00:00
Fedor
e91d3fcb58 tests: add failing test for workspace update-stale in colocated repos
Add a test that reproduces the bug where "workspace update-stale" fails
in colocated repos with the same "working copy is stale" error it's
supposed to fix.
2025-12-02 11:43:42 +00:00
Yuya Nishihara
d504ac9482 cli: warn only unmatched exact patterns of cloned bookmarks, use remote default
Since the specified patterns are no longer guaranteed to match at least one
remote branch, the default (remote) branch is taken into account if exact
patterns match nothing. I think this is better because `-b glob:*` is now
identical to the default.
2025-12-02 10:56:39 +00:00
Yuya Nishihara
3d80438a2c cli: exclude non-exact patterns from warning of remotes to fetch
The remote patterns will also be migrated to string matcher expressions.
2025-12-02 10:56:39 +00:00
Yuya Nishihara
766f39d791 cli: wrap "git fetch --branch" arguments in Option type
This makes it clear that the per-remote defaults are loaded from .git/config and
no warnings should be printed in that case.
2025-12-02 10:56:39 +00:00
Yuya Nishihara
e42c1a6b10 cli: exclude non-exact patterns from warning of fetched bookmarks
The warning message is slightly adjusted to be similar to the other "no
matching" warnings. I don't think the new formatting is better, but it's not
worse either.
2025-12-02 10:56:39 +00:00
Yuya Nishihara
906a5db495 cli: warn only unmatched exact patterns of bookmarks to push
This prepares for migration to parse_union_name_patterns().
2025-12-02 10:56:39 +00:00
Yuya Nishihara
57cd7842c0 tests: don't create new identical commit in test_git_clone_branch()
It's important in this test that "feature1" points to a different commit than
"main".
2025-12-02 10:56:39 +00:00
Yuya Nishihara
3b0f22ac74 cli: migrate experimental-advance-branches to parse_union_name_patterns()
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
We no longer need AdvanceBookmarksSettings type because the parsed result can be
a single StringMatcher. This patch also adds the defaults to config/misc.toml to
simplify error handling.
2025-12-02 02:27:27 +00:00
Yuya Nishihara
4a0bbe400a tests: fix bad renames in test_advance_bookmarks_overrides()
It's broken since d9c68e08. The config key wasn't renamed to "bookmarks".
2025-12-02 02:27:27 +00:00
Yuya Nishihara
713e57e6fe cli: bookmark, tag: migrate to parse_union_name_patterns()
"jj bookmark move" no longer shows a warning for named bookmarks not pointing to
the --from revisions. I think that's okay. `move --from=REV 'PATTERN ~ main'` is
a valid use case, and "main" shouldn't be warned.
2025-12-02 01:51:22 +00:00
Yuya Nishihara
a509f8f143 cli: warn only unmatched exact patterns of local tags 2025-12-02 01:51:22 +00:00
Yuya Nishihara
99b5d32e02 cli: warn only unmatched exact patterns of remote bookmarks 2025-12-02 01:51:22 +00:00
Yuya Nishihara
7d9d15b534 cli: warn only unmatched exact patterns of local bookmarks
This prepares for migration to parse_union_name_patterns(). find_bookmarks*()
will be inlined, and new helper function for unmatched warnings will be added.
2025-12-02 01:51:22 +00:00
Matt Stark
25cf636e19 revsets: Update message to clarify that the default is usually exact. 2025-12-01 23:19:59 +00:00
dependabot[bot]
d524970bc5 github: bump the github-dependencies group with 4 updates
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
Bumps the github-dependencies group with 4 updates: [taiki-e/install-action](https://github.com/taiki-e/install-action), [EmbarkStudios/cargo-deny-action](https://github.com/embarkstudios/cargo-deny-action), [actions/setup-python](https://github.com/actions/setup-python) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `taiki-e/install-action` from 2.62.57 to 2.62.60
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](763e3324d4...3575e53270)

Updates `EmbarkStudios/cargo-deny-action` from 2.0.13 to 2.0.14
- [Release notes](https://github.com/embarkstudios/cargo-deny-action/releases)
- [Commits](f2ba7abc2a...76cd80eb77)

Updates `actions/setup-python` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](e797f83bcb...83679a892e)

Updates `github/codeql-action` from 4.31.5 to 4.31.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](fdbfb4d275...fe4161a26a)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.62.60
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-version: 2.0.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: actions/setup-python
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 17:28:48 +00:00
dependabot[bot]
3cce4cb82e cargo: bump the cargo-dependencies group with 6 updates
Bumps the cargo-dependencies group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [criterion](https://github.com/criterion-rs/criterion.rs) | `0.7.0` | `0.8.0` |
| [insta](https://github.com/mitsuhiko/insta) | `1.44.1` | `1.44.3` |
| [jsonschema](https://github.com/Stranger6667/jsonschema) | `0.37.1` | `0.37.4` |
| sapling-streampager | `0.11.0` | `0.11.2` |
| [tracing](https://github.com/tokio-rs/tracing) | `0.1.41` | `0.1.43` |
| [tracing-subscriber](https://github.com/tokio-rs/tracing) | `0.3.20` | `0.3.22` |


Updates `criterion` from 0.7.0 to 0.8.0
- [Release notes](https://github.com/criterion-rs/criterion.rs/releases)
- [Changelog](https://github.com/criterion-rs/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/criterion-rs/criterion.rs/compare/criterion-plot-v0.7.0...criterion-v0.8.0)

Updates `insta` from 1.44.1 to 1.44.3
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.44.1...1.44.3)

Updates `jsonschema` from 0.37.1 to 0.37.4
- [Release notes](https://github.com/Stranger6667/jsonschema/releases)
- [Changelog](https://github.com/Stranger6667/jsonschema/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stranger6667/jsonschema/compare/cli-v0.37.1...rust-v0.37.4)

Updates `sapling-streampager` from 0.11.0 to 0.11.2

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

Updates `tracing-subscriber` from 0.3.20 to 0.3.22
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.20...tracing-subscriber-0.3.22)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: insta
  dependency-version: 1.44.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: jsonschema
  dependency-version: 0.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: sapling-streampager
  dependency-version: 0.11.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: tracing
  dependency-version: 0.1.43
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: tracing-subscriber
  dependency-version: 0.3.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 16:58:38 +00:00
Hubert Lefevre
b523980445 cli: fix: Add a detailed execution example
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
Add a detailed example of what will `jj fix` do.
2025-12-01 08:57:35 +00:00
Hubert Lefevre
42a713b5e4 docs: Move jj fix configuration documentation to config.md
In order to write config settings of tools for jj fix, you needed
information that were split in the `jj fix --help` text and
`jj help -k config` (or the respective web-pages).

Move every bit of information that is important to know to write
`jj fix` configurations in the config page. This avoid to have to
maintain the information up-to-date in two places.

Organize the help text of `jj fix` with several chapters.
2025-12-01 08:57:35 +00:00
Hubert Lefevre
b6728ce059 cli: fix: Precise the patterns are filesets
It is not mentioned and if you are new to jj you would not know what
the syntax is. While pretty obvious once you heard about filesets.
2025-12-01 08:57:35 +00:00
Yuya Nishihara
948c43075b templates: use join() when contents shouldn't become empty
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-01 01:13:25 +00:00
Yuya Nishihara
4518bd14b4 docs: add example of using $PAGER variable if set
#8159
2025-12-01 01:13:19 +00:00
Martin von Zweigbergk
5215a643b3 glossary: avoid saying "the latest version of a revision"
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
Since we use "revision" and "commit" as synonyms, it's confusing to
say that "the latest version of revision".

Closes #7912.
2025-11-30 18:49:04 +00:00
David Higgs
cd3dd79201 rebase: remove invariant checks
Users cannot rebase and request both --onto and --insert-before: this is
enforced by clap as well as panics in compute_commit_location. Remove the
unnecessary validation.
2025-11-30 13:05:39 +00:00
George Christou
711484da7d log: add --count flag
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
Inspired by @indirect's talk at JJ Con (https://www.youtube.com/watch?v=ZnTNFIMjDwg)
2025-11-29 17:21:07 +00:00
David Higgs
a1c9c3daff tests: demonstrate squash-moves with bookmarks 2025-11-29 13:21:58 +00:00
Stephen Jennings
eb64739ede docs: Add Jujutsu for Git experts
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
2025-11-28 06:08:41 +00:00
Joseph Lou
5ec2604af4 config: Clean up templates.toml
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
- Wrapped all lines to 80 columns (using `concat()` where able).
- Dedented all TOML values.
- Put all close parentheses on their own line (looks more balanced).
- Added trailing commas for variadic functions such as `concat()` and
  `separate()`.
- Fixed "(redacted)" bug for `format_operation_redacted(op)`.
2025-11-27 05:12:11 +00:00
Mitchell Skaggs
2af8bf94a3 testutils: add check for strict UTF-8 filesystems
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
`test_init_load_non_utf8_path` and
`test_init_additional_workspace_non_utf8_path` now early-return on
strict UTF-8 filesystems because there's no way to report a test as
"skipped" at runtime.

Closes https://github.com/jj-vcs/jj/issues/8118
2025-11-27 00:36:39 +00:00
QingyaoLin
f3a749fbff docs: update nushell completion
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-11-26 15:20:37 +00:00
Martin von Zweigbergk
47c35aa553 changelog: delete mistaken full stop
I suppose it could be a comma instead.
2025-11-26 14:50:06 +00:00
Yuya Nishihara
d444f0578a cli: show warnings for unmatched exact bookmark/tag patterns to list
The idea is the same as filesets. We emit warnings for exact names that don't
exist in the search space.
2025-11-26 14:46:17 +00:00
Yuya Nishihara
b78ec81023 str_util: add StringExpression::exact_strings() iterator
The implementation is copied from FilesetExpression.
2025-11-26 14:46:17 +00:00
Lander Brandt
7e42895b59 lib: substantially reduce syscalls when attempting to create dirs
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
After filing https://github.com/jj-vcs/jj/issues/7685 I ran some perf traces to try to understand just what was taking so long during these slow operations. The changes in this PR reduces clone time for my large repo from about 10 minutes to 4m30s.

You can see my thought process in the comments of the above task but to summarize:

During checkout we check files/directories being created to ensure that we are not attempting to write to a reserved directory (`.jj/`, `.git/`). `same_file::is_same_file()` is an expensive check that invokes _at least 4_ syscalls when called in a naive manner (`open()` and `close()` for each path -- plus possibly more for getting file info? I haven't counted).

There are a few optimization gaps here that are causing significant slowdowns. The following checklist reflects what I've optimized in this PR, and what still remains:

- [x] `create_parent_dirs` will be called for each file/directory and for each parent dir in a path **try to create it and check if the dir is an illegal name via `reject_reserved_existing_path()`**. There is no caching of directories which have already been created.
- [ ] `reject_reserved_existing` calls `same_file::is_same_file()` in a loop for all reserved names, but the path which _has maybe been created_ isn't going to change, so its handle could be cached.
- [ ] `can_create_new_file` attempts to create the file then just uses the result as an indicator of whether or not the file is created. However, since we _have a `File`_ that `File` can be directly converted to a `same_file::Handle` and avoid a syscall that currently occurs when converting the `Path` to a `same_file::Handle`.
- [ ] `can_create_new_file` deletes the file immediately after. There's probably an opportunity here to **not** delete the file and re-use it for file write operations.
- [ ] Say we have 1000 files in `foo/`. For each file that's written, `reject_reserved_existing` is going to make at least `RESERVED_DIR_NAMES.len() * 1000` syscalls constructing `foo/{reserved_dir_name}` paths, testing their existence, etc. Maybe `jj` might create this dir? But I don't think that should ever happen -- so why not cache the handle **if** it's created and use a lookup table in `reject_reserved_existing` to only conduct these types of checks if the handle is resolved? Or alternatively cache that the file _does not_ exist after the first check.

Here are some perf traces of running a `jj git clone` of my large repo before:

Release: https://share.firefox.dev/4oiSTBw
Debug: https://share.firefox.dev/4qmJBX1

And after:

Release: https://share.firefox.dev/4nK66mH
Debug: https://share.firefox.dev/470W1ed
2025-11-26 02:30:31 +00:00
Ilya Grigoriev
f0b0171bc5 deps: update gix, test change 2025-11-26 01:14:58 +00:00
Ilya Grigoriev
4b0f493abb test_git_clone: update test to prepare for gitoxide update
The next version of gix would pass invalid port number and
jj would pass the URL to the git binary, resulting in a
different error.
2025-11-26 01:14:58 +00:00
dependabot[bot]
2f0132a765 deps: update insta 2025-11-26 01:14:58 +00:00
dependabot[bot]
3dbb6a3f4c deps: update dependencies
This is https://github.com/jj-vcs/jj/pull/8108 without the update to
jsonschema or insta or gix.
2025-11-26 01:14:58 +00:00
Steve Klabnik
5b3aa51140 docs: jj-vcs.github.io -> jj-vcs.dev
As a follow-up to #8115, this moves all references in the codebase to use the new website.

I didn't update the older CHANGELOG entries because I figured they're intended
to be immutable.
2025-11-26 00:36:39 +00:00
Joseph Lou
0563f4f559 docs: Add myself as a paid contributor 2025-11-25 21:28:19 +00:00
Martin von Zweigbergk
7f28aad17d docs: fix some typos
Most of these were noticed by @omahs (thanks). I also fixed another
instance of "the the".
2025-11-25 20:27:59 +00:00