Yuya Nishihara
be35ab164c
tests: restore snapshots of line/word-oriented diff hunks
...
test_diff_basic() is now testing file-level changes such as renames.
2024-08-16 22:16:36 +09:00
Matt Kulukundis
2f2e5fb72a
copy-tracking: implement copy tracking for external tools
2024-08-16 07:48:43 -04:00
dependabot[bot]
7baf6675e7
github: bump github/codeql-action in the github-dependencies group
...
Bumps the github-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action ).
Updates `github/codeql-action` from 3.26.1 to 3.26.2
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](29d86d22a3...429e197704
)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-08-16 18:50:11 +08:00
Yuya Nishihara
085e17e1cc
files: micro-optimzie DiffLine::reset_line() to not clone hunks
2024-08-16 09:30:30 +09:00
Yuya Nishihara
a973c7b0ea
files: replace precomputed has_left/right_content flags with functions
...
I don't think the iteration cost would matter here, and it doesn't make sense
that has_left/right_content are cached whereas is_unmodified() isn't.
2024-08-16 09:30:30 +09:00
Yuya Nishihara
cca5277184
diff: clarify that DiffLine hunk doesn't have [left, right] diff pair
...
This will simplify users of line.hunks[] which I'm going to add.
2024-08-16 09:30:30 +09:00
Yuya Nishihara
ac27365290
files: ensure that DiffLineIterator hunk has exactly two inputs
...
I've made the constructor public, so let's add more sanity checks.
2024-08-16 09:30:30 +09:00
Matt Kulukundis
95e8dd51eb
copy-tracking: add support for diff --git
2024-08-15 11:03:39 -04:00
dependabot[bot]
5694f235dd
github: bump github/codeql-action in the github-dependencies group
...
Bumps the github-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action ).
Updates `github/codeql-action` from 3.26.0 to 3.26.1
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](eb055d739a...29d86d22a3
)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-08-15 09:11:31 -05:00
Yuya Nishihara
78c0128ec3
files: make DiffLineIterator accept generic DiffLine iterator
...
I'm thinking of adding some heuristics to render hunks containing lots of
small word changes differently, in a similar manner to the unified diffs. This
patch might help add some pre/post-processing at consumer.
files::diff() is inlined to caller to get around 'self borrowing.
2024-08-15 20:06:12 +09:00
Yuya Nishihara
f85792288f
files: replace Vec + index access with iterator in DiffLineIterator
2024-08-15 20:06:12 +09:00
Yuya Nishihara
54f5c01eae
files: use imported DiffHunk type in DiffLineIterator
2024-08-15 20:06:12 +09:00
Yuya Nishihara
a62c8776e8
diff: move empty content optimization from diff() to Diff::for_tokenizer()
...
unchanged_ranges() already has the fast path for empty content, but we can
also disable tokenization.
2024-08-15 20:06:12 +09:00
Yuya Nishihara
73e4daf5ce
tests: add more empty content diff samples
2024-08-15 20:06:12 +09:00
Yuya Nishihara
8b222e4038
cli: propagate BackendError from tree diffs
2024-08-15 20:02:56 +09:00
Benjamin Tan
ab604b4ecd
rewrite::move_commits()
: preserve order of parent commits
...
When rebasing a new child commit on top of the moved commit(s), the
order of the new child commit's parent commits is now correctly
preserved if the original parent commit is now a parent of the moved
commit(s).
Closes #3969 .
2024-08-15 17:51:03 +08:00
Benjamin Tan
4a17b9fbe4
rebase: modify tests to avoid printing commit and change IDs
...
I think they were adding too much noise to commit diffs. Only the tests
focused on skipping rebasing will include the commit and change IDs,
other tests will omit them.
2024-08-15 17:51:03 +08:00
Matt Kulukundis
0b179dcbde
copy-tracking: implement copy-tracking for --types
2024-08-14 20:48:43 -04:00
Matt Kulukundis
eccc3e235d
copy-tracking: diff --name-only
is a no-op
2024-08-14 19:52:19 -04:00
dependabot[bot]
49577f7f75
cargo: bump indexmap from 2.3.0 to 2.4.0 in the cargo-dependencies group
...
Bumps the cargo-dependencies group with 1 update: [indexmap](https://github.com/indexmap-rs/indexmap ).
Updates `indexmap` from 2.3.0 to 2.4.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md )
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.3.0...2.4.0 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-08-15 00:57:34 +08:00
Benjamin Tan
41e99ccdbf
diff_util: add copy records tracking to DiffRenderer::show_patch
...
This allow `jj show --summary` and other commands to include copy
tracking information.
2024-08-14 23:16:17 +08:00
Benjamin Tan
f983021814
cli: add basic tests for show command
2024-08-14 23:16:17 +08:00
Matt Kulukundis
b67b774ba7
fix: small clippy warning
2024-08-14 10:21:28 -04:00
Essien Ita Essien
a6d8009097
Define builtin_immutable_heads()
as a default revset alias.
...
* Add `builtin_immutable_heads()` in the `revsets.toml`.
* Redefine `immutable_heads()` in terms of `builtin_immutable_heads()`
* Warn if user redefines `builtin_immutable_heads()`, `mutable()` or
`immutable()`.
* Update module constant in revset_util.rs from BUILTIN_IMMUTABLE_HEADS
to USER_IMMUTABLE_HEADS to avoid confusion since it points at
`immutable_heads()` **and** we now have a revset-alias
literally named `builtin_immutable_heads()`.
* Add unittest
* Update CHANGELOG
* Update documentation.
Fixes : #4162
2024-08-14 11:32:16 +01:00
Matt Kulukundis
ec99a17ae8
copy-tracking: improve --summary and add --stat
...
- add support for copy tracking to `diff --stat`
- switch `--summary` to match git's output more closely
- rework `show_diff_summary` signature to be more consistent
2024-08-13 21:37:45 -04:00
dependabot[bot]
f5a25d7805
cargo: bump the cargo-dependencies group with 2 updates
...
Bumps the cargo-dependencies group with 2 updates: [clap_complete](https://github.com/clap-rs/clap ) and [serde](https://github.com/serde-rs/serde ).
Updates `clap_complete` from 4.5.14 to 4.5.16
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.14...clap_complete-v4.5.16 )
Updates `serde` from 1.0.206 to 1.0.207
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.206...v1.0.207 )
---
updated-dependencies:
- dependency-name: clap_complete
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-08-13 11:58:14 -07:00
Aaron Bull Schaefer
e803bed845
config: expand tilde in ssh key filepaths
...
Add home directory expansion for SSH key filepaths. This allows the
`signing.key` configuration value to work more universally across both
Linux and macOS without requiring an absolute path.
This moved and renamed the previous `expand_git_path` function to a more
generic location, and the prior use was updated accordingly.
2024-08-13 08:06:43 -07:00
Yuya Nishihara
a609580204
revset: avoid merging whole parent trees by file()/diff_contains() query
...
Perhaps, we should also cache merged trees, but this patch saves time until
we implement the bookkeeping. Even if we had a cache, it wouldn't be ideal to
calculate uncached merged trees during revset evaluation.
```
% hyperfine --sort command --warmup 3 --runs 10 -L bin jj-1,jj-2 \
'target/release-with-debug/{bin} -R ~/mirrors/git --ignore-working-copy \
log -r "::@ & file(root:builtin)" --no-graph -n50'
Benchmark 1: target/release-with-debug/jj-1 ..
Time (mean ± σ): 3.512 s ± 0.014 s [User: 3.391 s, System: 0.119 s]
Range (min … max): 3.489 s … 3.528 s 10 runs
Benchmark 2: target/release-with-debug/jj-2 ..
Time (mean ± σ): 1.351 s ± 0.010 s [User: 1.275 s, System: 0.074 s]
Range (min … max): 1.332 s … 1.366 s 10 runs
Relative speed comparison
2.60 ± 0.02 target/release-with-debug/jj-1 ..
1.00 target/release-with-debug/jj-2 ..
```
2024-08-13 15:02:24 +09:00
Yuya Nishihara
13f0a2f008
revset: inline materialized_diff_stream() in diff_contains() evaluation function
...
I'll add conflict resolution there.
This change adds more synchronization points, which is probably bad for
concurrency. However, this module is a revset engine for the default index,
so the store backends are supposed to be fast local disks.
2024-08-13 15:02:24 +09:00
Yuya Nishihara
c651930e9a
revset: pass valid file paths to diff_contains() error
2024-08-13 15:02:24 +09:00
Yuya Nishihara
145f942d99
merged_tree: add function that resolves file conflicts non-recursively
...
Conflict resolution is expensive, so I'm going to make file()/diff_contains()
revsets not resolve the whole parent trees.
2024-08-13 15:02:24 +09:00
Yuya Nishihara
a6566832c2
merged_tree: extract file-conflict resolution from merge_tree_values()
...
I'll add a public function that resolves file conflicts. This function will
take owned MergedTreeValue, and that's why the extracted function returns
None instead of cloning the passed value.
2024-08-13 15:02:24 +09:00
Benjamin Tan
38f6ee8918
cargo: bump git2
to 0.19.0
...
This includes a bump of `libgit2` to v1.8.1.
2024-08-13 11:47:21 +08:00
dependabot[bot]
2c9311bccf
cargo: bump the cargo-dependencies group with 5 updates
...
Bumps the cargo-dependencies group with 5 updates:
| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap ) | `4.5.14` | `4.5.15` |
| [clap_complete](https://github.com/clap-rs/clap ) | `4.5.13` | `4.5.14` |
| [serde](https://github.com/serde-rs/serde ) | `1.0.205` | `1.0.206` |
| [serde_json](https://github.com/serde-rs/json ) | `1.0.122` | `1.0.124` |
| [syn](https://github.com/dtolnay/syn ) | `2.0.72` | `2.0.74` |
Updates `clap` from 4.5.14 to 4.5.15
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.14...v4.5.15 )
Updates `clap_complete` from 4.5.13 to 4.5.14
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.13...clap_complete-v4.5.14 )
Updates `serde` from 1.0.205 to 1.0.206
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.205...v1.0.206 )
Updates `serde_json` from 1.0.122 to 1.0.124
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.122...v1.0.124 )
Updates `syn` from 2.0.72 to 2.0.74
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/2.0.72...2.0.74 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: clap_complete
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-08-12 18:09:31 +02:00
Yuya Nishihara
f7377fbbcd
merged_tree: replace MergedTreeVal<'_> by Merge<Option<&TreeValue>>
...
MergedTreeVal was roughly equivalent to Merge<Option<Cow<_>>. As we've dropped
support for the legacy trees, it can be simplified to Merge<Option<&_>>.
2024-08-12 23:01:46 +09:00
Yuya Nishihara
2977900482
merge: move non-consuming Merge<Option<TreeValue>> methods to generic type
...
The next patch will add .is_tree() callers, and the other methods don't
required owned type.
2024-08-12 23:01:46 +09:00
Yuya Nishihara
8268af9b4f
merge: add helper function to match Option<impl Borrow<TreeValue>>
...
More callers will be added by the next commit.
2024-08-12 23:01:46 +09:00
Yuya Nishihara
accd1e337a
merge: add .cloned() method that maps inner Option<&T> to Option<T>
...
MergedTreeVal::to_merge() will be replaced with this.
2024-08-12 23:01:46 +09:00
Benjamin Tan
e2ab6d4f42
rewrite: migrate move_commits
function from rebase
command
2024-08-12 21:48:17 +08:00
Benjamin Tan
9c1b627f9b
jj_lib: include indexmap
as dependency
...
This is in preparation for shifting of `move_commits` function to
`jj_lib::rewrite`.
2024-08-12 21:48:17 +08:00
Ilya Grigoriev
206c0cf830
docs: document how to compile a statically linked binary on Mac
...
I feel like this is worth documenting, as it shouldn't require
Homebrew.
2024-08-11 20:10:37 -07:00
Yuya Nishihara
fd52efa0ba
merged_tree: leverage Merge<Tree> entries iterator in all_tree_entries()
2024-08-12 10:20:34 +09:00
Yuya Nishihara
88018e84fc
merged_tree: micro-optimize Merge<Tree> entries iterator to return &TreeValue
...
try_resolve_file_conflict() is also updated. It could be a generic function,
but there are only two callers, and the legacy tree one is used only in tests.
2024-08-12 10:20:34 +09:00
Yuya Nishihara
6d6f5990de
merged_tree: add merge-join iterator over Merge<Tree> entries
...
For the same reason as 2cb7e91d
"merged_tree: do not re-look up non-conflicting
tree values by name." This appears to bring a similar performance improvement.
I assume this change is/will be covered by test_merged_tree.rs. I considered
adding a few unit tests, but constructing Tree object isn't trivial, and the
iterator implementation is relatively straightforward.
2024-08-12 10:20:34 +09:00
Matt Kulukundis
5911e5c9b2
copy-tracking: Add copy tracking as a post iteration step
...
- force each diff command to explicitly enable copy tracking
- enable copy tracking in diff_summary
- post-process for diff iterator
- post-process for diff stream
- update changelog
2024-08-11 17:01:45 -04:00
Matt Kulukundis
0349d9ead3
copy-tracking: extract next_impl from next in diff iter/stream
2024-08-11 17:01:45 -04:00
Matt Kulukundis
34b0f87584
copy-tracking: plumb CopyRecordMap through diff method
2024-08-11 17:01:45 -04:00
Matt Kulukundis
6bae5eaf9d
copy-tracking: create a MaterializedTreeDiffEntry type
2024-08-11 17:01:45 -04:00
Matt Kulukundis
e123eb21b9
copy-tracking: add source
field to TreeDiffEntry
...
- add the field and make it compile, but don't use it yet
2024-08-11 17:01:45 -04:00
Matt Kulukundis
8e84c60157
copy-tracking: create an explicit TreeDiffEntry struct
2024-08-11 17:01:45 -04:00