Commit graph

3356 commits

Author SHA1 Message Date
Yuya Nishihara
f475122b7e tree_builder: simply map Tree to backend::Tree in later pass
I'll rewrite populate_trees() as a recursive function, so I want to minimize
the objects to be passed to the function.
2023-06-02 12:23:37 +09:00
Yuya Nishihara
0846d7fc8b tree_builder: remove unneeded "mut" self 2023-06-02 12:23:37 +09:00
dependabot[bot]
633236701d github: bump github/codeql-action from 2.3.5 to 2.3.6
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.5 to 2.3.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0225834cc5...83f0fe6c49)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-01 09:20:29 -07:00
dependabot[bot]
59ee431467 cargo: bump criterion from 0.4.0 to 0.5.1
Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.4.0 to 0.5.1.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.4.0...0.5.1)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-01 09:20:14 -07:00
Yuya Nishihara
3d449c55b7 tree_builder: do not omit file entry which was previously a directory 2023-06-01 09:38:06 +09:00
Yuya Nishihara
68a30c934d tree_builder: when writing trees, rely on lexicographical order of RepoPath 2023-06-01 09:38:06 +09:00
Yuya Nishihara
ae9f7aba52 tests: add test for file-directory-file transition
TreeBuilder fails to handle directory-file transition right now, and leaves
the dirty file as "clean".
2023-06-01 09:38:06 +09:00
Martin von Zweigbergk
3a69fa48f6 conflicts: delete unused conflict_to_materialized_value() 2023-05-31 17:31:08 -07:00
Martin von Zweigbergk
35b19b1e28 cargo: upgrade clap from to 4.1.11 to 4.3.0
I changed `test_early_args` because the first line no longer has a
redundant color reset, so now we test the `Commands:` line instead,
which has actual color (well, bold+underline anyway).
2023-05-31 12:32:26 -07:00
dependabot[bot]
581b6ef28c cargo: bump chrono from 0.4.25 to 0.4.26
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.25 to 0.4.26.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.25...v0.4.26)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-31 16:10:03 +00:00
Martin von Zweigbergk
5653827101 cli: add pointer from error message to docs about stale working copy 2023-05-31 06:32:40 -07:00
Martin von Zweigbergk
fb17e6a50e revset: use different errors for ambiguous commit/change IDs
I made a typo and got something like this:

```
Error: Commit or change id prefix "wl" is ambiguous
```

Since we can tell commit ids from change ids these days, let's make
the error message say which kind of id it is. Changing that also kind
of forced me to make a special error for empty strings. Otherwise we
would have to arbitrarily say that an empty string is a commit id or
change id. A specific error message for empty strings seems helpful,
so that's probably for the better anyway.
2023-05-31 06:28:32 -07:00
Martin von Zweigbergk
97b81a0f12 working_copy: get conflict id from the current tree
This prepares for allowing the base tree to be a conflict at the
root-tree level (#1624).

We could remove the `Conflict` variant completely. I tried doing that
and it slowed down `jj diff` by ~3% in the Linux repo with a clean
working copy with only mtime bumped on all files.
2023-05-31 06:28:15 -07:00
Martin von Zweigbergk
a5883eba15 merge: make trivial_merge() return a reference
I don't know why I made it return an owned value. It seems like an
unnecessary restriction that the value implements `Clone`, so let's
return a reference instead.
2023-05-31 06:28:01 -07:00
Martin von Zweigbergk
3ca42908ee cleanup: avoid some unnecessary uses of Cursor
Most of our uses of `Cursor` can be replaced by just mutable slices,
which seems simpler, so I guess that's preferred.
2023-05-30 21:06:24 -07:00
Martin von Zweigbergk
a5ef4f0f40 merge_tools: avoid re-reading edited file, read from buffer instead
I suspect this was just because it wasn't obvious to the author how to
get a `Read` from an in-memory buffer (I know it wasn't to me).
2023-05-30 21:06:24 -07:00
dependabot[bot]
04a107babf cargo: bump once_cell from 1.17.1 to 1.17.2
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.1 to 1.17.2.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.17.1...v1.17.2)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 20:26:10 +02:00
dependabot[bot]
f27fef09d9 cargo: bump chrono from 0.4.24 to 0.4.25
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.24 to 0.4.25.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.24...v0.4.25)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 20:25:38 +02:00
dependabot[bot]
b9f2f634be cargo: bump git2 from 0.17.1 to 0.17.2
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.17.1 to 0.17.2.
- [Changelog](https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.17.1...0.17.2)

---
updated-dependencies:
- dependency-name: git2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 20:25:04 +02:00
Yuya Nishihara
f27ac22ba4 index: unify evaluate_revset() implementations
The lifetime is a bit tricky since CompositeIndex is a reference wrapper
whereas Index trait has no notion about ownership.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
b7b9b8c88e index: pass only CompositeIndex to default_revset_engine::evaluate() 2023-05-29 08:15:40 +09:00
Yuya Nishihara
cf5cb380bb index: implement Index for CompositeIndex
We can't get rid of the other "impl Index"es because .as_composite() must
return a real reference type. Maybe we could turn CompositeIndex into an
owned wrapper, but I don't know if that would be worth the effort.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
5989bdf781 index: move Index::as_any() to MutableIndex, obtain CompositeIndex from there
It might sound scary to add public .mutable_index() accessor, but I think
it's okay because immutable MutableIndex reference has no more power than
Index.

This allows us to implement Index for lifetime-bound type such as
CompositeIndex<'_>.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
b9c8fd8ef3 index: make ReadonlyIndexImpl crate local
This ensure that callers will use ReadonlyIndexWrapper as the implementation
type.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
93284a153f index: obtain CompositeIndex from ReadonlyIndexWrapper
I'll remove Index::as_any() so that Index can be implemented for reference
wrapper.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
fb77c55268 index: use as_composite() to access to index stats
The idea is that .as_composite() is equivalent to .as_index(), but for the
implementation type. I'm going to add "impl Index for CompositeIndex" to
clean up index references passed to revset engine.
2023-05-29 08:15:40 +09:00
Yuya Nishihara
92c1b7091b index: make CompositeIndex copyable to clarify it is a cheap reference type
Well, I might change it to an owned wrapper later, but if I made such change,
the current CompositeIndex<'_> would be replaced with &CompositeIndex.
2023-05-29 08:15:40 +09:00
Martin von Zweigbergk
d047a8fbd4 tree: respect matcher.visit() when walking entries
This handles the basic case of where the matcher says that a whole
subtree is not matched. In the Linux repo, That's already enough to
speed up `jj --ignore-working-copy files samples` from 298 ms to 129
ms.
2023-05-28 07:28:16 -07:00
Martin von Zweigbergk
dbcecf7244 tree: rewrite recursive entries iterator to not use machine stack
In the same vein as c02c4168fe.
2023-05-28 07:28:16 -07:00
Martin von Zweigbergk
a897b27770 revset: minor fixes to documentation of graph iterator 2023-05-26 15:55:29 -07:00
Martin von Zweigbergk
7bf1ab712a progress: update progress only every 10 ms
In the Linux repo, this speeds up `jj diff` in a clean working copy
from 1.41 s to 881 ms.
2023-05-26 12:22:29 -07:00
dependabot[bot]
1fa88dbad0 github: bump github/codeql-action from 2.3.4 to 2.3.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f0e3dfb303...0225834cc5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-26 17:09:56 +00:00
dependabot[bot]
fe90574b37 cargo: bump regex from 1.8.2 to 1.8.3
Bumps [regex](https://github.com/rust-lang/regex) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.8.2...1.8.3)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-26 16:11:49 +00:00
dependabot[bot]
b2ecabe89a github: bump github/codeql-action from 2.3.3 to 2.3.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.3 to 2.3.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](29b1f65c5e...f0e3dfb303)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-25 16:12:55 +00:00
Aaron Bull Schaefer
d10af403a5 cleanup: fix minor typos in function names
> error: `mutliple` should be `multiple`
> error: `visble` should be `visible`

Found via typos:
- https://github.com/crate-ci/typos
2023-05-25 08:43:06 -07:00
Martin von Zweigbergk
d087e64abf cleanup: consistently (?) put removed conflict terms before added ones 2023-05-25 04:24:26 -07:00
Martin von Zweigbergk
97c64d8071 tree: leverage trivial_merge() for file executable bit 2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
f838d083d3 tree: add test of merge of executable bit
We didn't seem to have any tests of this, so let's add one before I
change the implementation.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
28d3ad6f1d files: add more multi-hunk tests
We seemed to have poor coverage of merges affecting multiple hunks, so
I added a few. Thanks to @quark-zju for providing the last of them.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
1c284322b3 files: leverage trivial_merge() in merge()
Note that one test changed because the new `trivial_merge()` is more
strict than the old algorithm. I don't think that's a problem because
5-way conflicts are not very common, and I prefer to be strict now and
possibly relax it later if we decide that we would prefer that.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
61c1b9f4eb files: add another test of a 5-way merge
Just to show that this case doesn't change in the next commit.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
1ec906b114 files: make merge() require one more adds than removes
All call paths already check before calling the function that the
condition is true. One caller - `tree::try_resolve_file_conflict()` -
checks it itself. The other caller -
`conflicts::materialize_merge_result()` - doesn't, but its callers
have checked it via `extract_file_conflict_as_single_hunk()`.

The deleted comment about empty strings seems to be obsolete since
e48ace56d1. The caller pads the inputs with empty strings since that
commit.

I think we should ideally change this function's signature to make it
impossible to call it with bad inputs, and I hope to get back to that
soon.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
3069718c0f refs: leverage trivial_merge() in merge_ref_targets() 2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
451af92912 tree: leverage trivial_merge() in merge_trees() 2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
ef7b831411 merge: optimize 3-way merge case
I haven't done any profiling to see if this is actually useful, but
it's also pretty simple to do.
2023-05-24 22:00:38 -07:00
Martin von Zweigbergk
aa2792c5e5 merge: add a generic function for resolving trivial N-way merges
We already resolve merge conflicts between hunks, trees, and refs, and
maybe more. They each have their own code for the handling trivial
merges (where the output is equal to one of the inputs). They look
surprisingly different. This commit adds a generic function for doing
that. Curiously, this new implementation uses implements it in yet
another way (basically using a multi-set).
2023-05-24 22:00:38 -07:00
dependabot[bot]
69a7df1715 github: bump cachix/install-nix-action from 20 to 21
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 20 to 21.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](29bd9290ef...4b933aa7eb)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-24 16:13:59 +00:00
dependabot[bot]
6e09e47129 cargo: bump toml_edit from 0.19.9 to 0.19.10
Bumps [toml_edit](https://github.com/toml-rs/toml) from 0.19.9 to 0.19.10.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.9...v0.19.10)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-24 16:11:45 +00:00
dependabot[bot]
3c1183fb38 cargo: bump regex from 1.8.1 to 1.8.2
Bumps [regex](https://github.com/rust-lang/regex) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.8.1...1.8.2)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-23 16:13:49 +00:00
Yuya Nishihara
8157c4a926 index: remove walk_revs() from trait API
It only makes sense for the DefaultIndexStore.
2023-05-24 01:02:37 +09:00