Commit graph

3373 commits

Author SHA1 Message Date
Steve Klabnik
7da170d53f docs: mention ?? means 'divergence'
While divergence is talked about in the documentation, few places actually
mention how divergent changes are displayed. I've added such notes to the help
out put of `jj log`, the glossary, and added an example to the guide we have on
divergence.

Fixes #6365
2025-12-08 21:09:51 +00:00
David Higgs
b0f2f33e1c tests: exercise squashing a non-revset file
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-06 13:11:12 +00:00
David Higgs
bfcef5d9ef tests: exercise interactively squashing no changes 2025-12-06 13:11:12 +00:00
David Higgs
4191f13edd tests: exercise squashing @ with destination 2025-12-06 13:11:12 +00:00
David Higgs
914edae4a3 tests: exercise resolve for other revisions 2025-12-06 13:11:12 +00:00
David Higgs
8526ea1ff6 tests: exercise revert of nothing 2025-12-06 13:11:12 +00:00
David Higgs
ee650cb6a2 tests: exercise reverse order diff and --to 2025-12-06 13:11:12 +00:00
David Higgs
aab490392f tests: exercise reverse-order diffedit and --to 2025-12-06 13:11:12 +00:00
David Higgs
a60ed7746b tests: exercise status without working copy 2025-12-06 13:11:12 +00:00
David Higgs
59f80b1133 tests: confirm bookmark set warns when auto-tracking existing bookmark 2025-12-06 13:11:12 +00:00
David Higgs
9c855ffc9f tests: exercise workspace config paths 2025-12-06 13:11:12 +00:00
David Higgs
136adf4483 tests: exercise warning about changing author 2025-12-06 13:11:12 +00:00
David Higgs
11c7faa7fd tests: exercise empty config output 2025-12-06 13:11:12 +00:00
Martin von Zweigbergk
11f58fc3be cli: copy note about jj op show -p from absorb to fix
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-06 01:04:00 +00:00
xtqqczze
c49a60e5eb clippy: enable unnecessary_literal_bound lint
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-05 17:07:44 +00:00
xtqqczze
b0ee9bdd09 clippy: fix cast_lossless lint
https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
2025-12-05 01:42:41 +00:00
Ian Wrzesinski
bcfd5c977c config: Add "exec-bit-change" setting for overriding policy on Unix 2025-12-04 17:32:40 +00:00
Ian Wrzesinski
8dda6b6996 working_copy: Clean up ExecBit interface and preserve on-disk exec state on Windows 2025-12-04 17:32:40 +00:00
Ian Wrzesinski
bea5882e13 working_copy: Rename FileExecutableFlag to ExecBit and update variables
The main reason for this change is that we now give variables different names
based on their types. This helps avoid confusion and makes intent clearer.
However, the type name `FileExecutableFlag` doesn't have a good shortening
(`file_exec_flag` is annoyingly long), so I also renamed the type to something
shorter, which makes the code more legible: easier to mentally parse and
quicker to type.

I removed `File` from the name both for length and because it doesn't really
help distinguish from the executable field in `TreeValue` (because that field
is nested under `TreeValue::File`). Instead, in the upcoming commits I update
comments to consistently use the terms 'on-disk' and 'in-repo' to respectively
refer to the fields in the `FileState` and `TreeValue` structs, which I find
is better for keeping the difference clear in my head.

I went with `Bit` in the new name just because I'm already changing it and I
prefer `exec_bit` slightly over `exec_flag` as the variable name.
2025-12-04 17:32:40 +00:00
Yuya Nishihara
406940a1fb cli: git clone: fix cleanup to ignore missing .jj and .git directories
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
fs::remove_dir_all() expects that the specified directory exists.

Fixes #8208
2025-12-04 11:55:28 +00:00
Yuya Nishihara
3a3834d4b2 cli: do not import Git refs by comparing against stale working-copy operation
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
Because the Git repository should be synchronized with the head operation, we
shouldn't import Git refs compared to the stale working-copy operation.

https://github.com/jj-vcs/jj/pull/8154#discussion_r2572787677
2025-12-04 01:44:49 +00:00
Yuya Nishihara
94b9c9e69c tests: add bookmarks that will be imported by colocated update-stale
The added test shows that update-stale re-imports bookmark and abandon commit
wrongly.
2025-12-04 01:44:49 +00:00
edef
da9924c75f cli: default Gerrit --remote-branch is gerrit.default-remote-branch
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
gerrit.default-branch does not seem to be a real option.
2025-12-03 11:44:03 +00:00
Yuya Nishihara
26faf46dc7 cli: migrate "git push --bookmark" to parse_union_name_patterns() 2025-12-03 08:12:58 +00:00
Yuya Nishihara
331df4c990 cli: migrate "git fetch --remote" to parse_union_name_patterns() 2025-12-03 08:12:58 +00:00
Yuya Nishihara
36143b093e git: add native support for negative fetch patterns
The default patterns are still saved to and loaded from .git/config. Maybe we
can add default fetch patterns to jj's configuration, but I'm not sure whether
we should deprecate .git/config fallback.
2025-12-03 08:12:58 +00:00
Yuya Nishihara
8615362689 git: compile both positive/negative branch patterns to StringMatcher
I also renamed "branch" to "bookmark" because we call refs as "bookmark"s where
the matcher is used.
2025-12-03 07:32:25 +00:00
Yuya Nishihara
c39f685e21 tests: fix and extend default Git fetch refspecs test
This test didn't work because add_commit_to_branch() inserts refs/heads/ prefix
internally. There were no branches matching the refspecs in the remote, and just
unborn "main" existed.

Since we don't care for auto tracking nor auto import/export in this test, I
also disabled these features to make the test more predictable.
2025-12-03 07:32:25 +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
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