ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

4097 commits

Author SHA1 Message Date
Martin von Zweigbergk
873a6f0674 merged_tree: add a function for merging 3 MergedTrees
With the already existing `MergedTree::resolve()` and all the recent
refactorings into `Merge<T>`, it's now very easy to add support for
3-way merging of `MergedTree` instances.
2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
1674a421ec commit_builder: take MergedTreeId for root id argument 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
e5ec99d159 backout: propagate error from merging of trees 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
b19afb6d45 cli: migrate jj untrack to MergedTree API 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
6d89f0c0a0 cli: migrate jj restore to MergedTree API 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
a0291e99d7 cli: migrate cat, files & git submodule print to MergedTree API 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
d753c85e01 cli: migrate most diff-editing functions to MergedTree API 2023-08-28 15:58:34 -07:00
Ilya Grigoriev
d3428d63a2 nix: Add poetry to devDependencies for nix develop
This should allow Nix users to build the documentation in
`nix develop` following the instructions in `contributing.md`.

It feels a little weird to add a package manager and ask
people to use it inside nix, but I think it's simpler
than having two sets of instructions and dependencies
to maintain.
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
b67c115c29 docs: goodbye Github, hello GitHub 2023-08-28 10:43:48 -07:00
Ilya Grigoriev
c8bb8fbeb2 Github actions to build docs
One action publishes the 'prerelease' version on every push
to `main`.

The other publishes a 'latest' version on every releasse.

I tested both of them, but not with branch protection rules.
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
8f29afaafd docs: markdown fixups, mostly to remove links pointing outside docs
This makes mkdocs compile cleanly
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
fc49258d2f docs: Set up mkdocs and poetry
I initially was thinking of using `mdbook`, which looks a little better, but I
think versioning the docs is important, and the features I want are pretty much
only supported by the Mkdocs' "Material" theme. 

Mkdocs is written in Python. The prerequesites for building docs on your
machine should be to install Python and Poetry, everything else should be
installed automatically by Poetry. See the edits to `contributing.md` for more details.
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
623c5e28c2 docs: change "shell script" codeblock to "shell"
```shell script
    ```

breaks mkdocs rendering
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
64140c34b7 docs: Move installation instructions from README to docs/
This allows the tutorial to reference them and will make it
easier to have different instructions for different versions.

We can later restore some instructions to the README, but I
think this is important since the installation instructions
do change in important (even if slight) ways from time to
time.
2023-08-28 10:43:48 -07:00
Ilya Grigoriev
d3bd1af37b docs: minor markdown fixups
I am not sure these are necessary with `mkdocs` that I settled on,
but this allows `mdbook` to parse the markdown properly.
2023-08-28 10:43:48 -07:00
dependabot[bot]
9d7419497c cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [regex](https://github.com/rust-lang/regex), [rustix](https://github.com/bytecodealliance/rustix) and [serde](https://github.com/serde-rs/serde).


Updates `regex` from 1.9.3 to 1.9.4
- [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.9.3...1.9.4)

Updates `rustix` from 0.38.8 to 0.38.9
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.8...v0.38.9)

Updates `serde` from 1.0.186 to 1.0.188
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.186...v1.0.188)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: rustix
  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>
2023-08-28 09:13:46 -07:00
Martin von Zweigbergk
732e448458 diff_util: use MergedTree throughout
This switches the whole `diff_util` module to working with
`MergedTree`, `Merge<Option<TreeValue>>` etc., so it can support
tree-level conflicts.

Since we want to avoid using `ConflictId`s, I switched the hash we use
for conflicts in `--git` style diffs to use an all-'0' id instead of
using the conflict id.
2023-08-27 07:50:28 -07:00
Martin von Zweigbergk
5309335405 diff_util: make diff_content() return empty for missing path
I'm not sure this is a win on its own, but it simplifies coming
patches.
2023-08-27 07:50:28 -07:00
Martin von Zweigbergk
5ef925deb8 diff_util: unify handling of unexpected cases
This moves the error cases last in each `match` block, switches to
using format strings, and includes the full value in the message.
2023-08-27 07:50:28 -07:00
Martin von Zweigbergk
6df7db3dc0 merge_tools: pass MergedTree to run_mergetool() 2023-08-27 07:35:01 -07:00
Martin von Zweigbergk
17fe5e39c5 merge_tools: pass MergedTrees to edit_diff() 2023-08-27 07:35:01 -07:00
Martin von Zweigbergk
54b9ecce68 merge_tools: pass MergeTree to run_mergetool_external() 2023-08-27 07:35:01 -07:00
Martin von Zweigbergk
a7e5ea06c0 tests: make test helper for snapshotting working copy return MergedTree 2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
1895a55157 working_copy: make old_checkout argument be MergedTreeId
I think this was the last piece for making the working copy handle
tree-level conflicts.
2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
abf3853717 working_copy: return MergedTreeId on snapshot 2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
88e9933462 working_copy: enable storing multiple tree ids in state file 2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
49e32aa532 merged_tree: teach tree builder to build multiple trees 2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
1577b408a6 store: add function to look up MergedTree by MergedTreeId
We'll start seeing `MergedTreeId` in more places and we'll want it to
be easy to look up the tree.
2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
2dd2e77170 merged_tree: add entries() for iterating over all entries
We already have `entries_matching()`, so this is just a version of
that that doesn't take a matcher.
2023-08-27 06:49:45 -07:00
Martin von Zweigbergk
36674e8f7e merged_tree: make id() return a MergedTreeId
We will rarely want to use the tree id without knowing whether it can
contain `TreeValue::Conflict` values, so let's make the callers check.
2023-08-27 06:49:45 -07:00
Yuya Nishihara
a0ae09f461 templates: reword signature placeholders to match description 2023-08-27 09:38:36 +09:00
Yuya Nishihara
f422f1300c templater: move empty signature placeholder to user template
This patch also extracts format_detailed_signature() function to deduplicate
the "show" template bits.

The added placeholder templates aren't labeled as "empty". If needed, I think
the whole template can be labeled as "empty" (or "empty_commit") just like
"working_copy".

Closes #2112
2023-08-27 09:38:36 +09:00
Yuya Nishihara
b45da80c12 tests: add more tests for empty signature
As I'm going to change the Signature type to not fill out a placeholder
message, we need to test the builtin templates as well.
2023-08-27 09:38:36 +09:00
Yuya Nishihara
88b509f857 tests: do not use "author" template keyword to test string functions
I'm going to change the default formatting of empty Signature type, and
these tests should use a non-empty keyword.
2023-08-27 09:38:36 +09:00
Martin von Zweigbergk
a186b5ffce cli: use MergedTree in jj chmod 2023-08-26 08:16:57 -07:00
Martin von Zweigbergk
d0fb154e7e cli: use MergedTreeBuilder in jj chmod 2023-08-26 08:16:57 -07:00
Martin von Zweigbergk
389f27f042 working_copy: move writing of conflict objects into new tree builder
This introduces a `MergedTreeBuilder` type, which takes a set of base
trees and overrides. The idea is that it will be able to write
multiple trees or a legacy tree. For now, it's only able to write
legacy trees. To show that it works, the working copy's snaphotting
code has been updated to use it.
2023-08-26 08:16:57 -07:00
Martin von Zweigbergk
e4ba6a42fc backends: store tree id conflicts as list with alternating signs
Now that we have `Merge::iter()` and friends, it's simpler to store
the tree ids in a single list.
2023-08-26 07:02:04 -07:00
Martin von Zweigbergk
fd4146d485 backend: use new enum for Commit::root_tree
We currently represent the root tree id in a commit by `Merge<TreeId>`
plus a boolean `uses_tree_conflict_format`. It's better to use an enum
for that. That makes it harder to forget to check which type of tree
it is, and it makes it impossible to store a legacy tree with multiple
ids (as we could with `uses_tree_conflict_format=false`,
`root_tree=Merge::new(...)`).

Maybe more importantly, we're also going to want to pass around this
information in most places where we currently pass a single `TreeId`,
and passing two separate values would be annoying.
2023-08-26 07:02:04 -07:00
Martin von Zweigbergk
e3d67d5e45 local_backend: allow storing legacy trees
Unlike the git backend, we don't need to support path-level conflicts
for existing repos because we don't care about compatibility with
existing repos using the native backend. However, we still need to
support both formats until all code paths are able to handle
tree-level conflicts.
2023-08-26 07:02:04 -07:00
Martin von Zweigbergk
589e0db3c5 git_backend: remove unused proto field for resolved tree id
We store resolved tree ids in the regular Git commit, so we we never
ended up using the `resolved` variant in the `root_tree`.
2023-08-26 07:02:04 -07:00
Martin von Zweigbergk
2fe4372121 tree_builder: remove unnecessary has_overrides() method
It's easy to instead check if the new tree id is different from the
tree id.
2023-08-26 07:02:04 -07:00
Martin von Zweigbergk
598cfcb89b merged_tree: in diff iterator, maintain legacy/modern variant in subtree
As #2165 showed, when diffing two `MergedTree::Legacy` variants (or
one of each variant) and re recurse into a subtree, we need to treat
that as a legacy tree too, so we expand `TreeValue::Conflict`s found
in the diff.
2023-08-26 05:58:54 -07:00
Martin von Zweigbergk
f3fbdf9f84 merged_tree: pass MergedTree into TreeDiffIterator::tree()
This converts `TreeDiffIterator::tree()` and
`TreeDiffIterator::single_tree()` into associated functions and passes
in the `&MergedTree` into the former. This prepares for fixing #2165,
and it removes the need for the `TreeDiffIterator::store` field.
2023-08-26 05:58:54 -07:00
Martin von Zweigbergk
769c248c49 working_copy: show bug when checking out conflict in subdir 2023-08-26 05:58:54 -07:00
Yuya Nishihara
79291a3ca4 revset: add separate name@remote node to discriminate it from quoted one
A local branch named "name@remote" no longer shadows a remote branch "name"
at "remote".
2023-08-26 07:47:12 +09:00
Yuya Nishihara
75ebdf69a1 revset: parse @ like operator (but without alias substitution)
This is what I proposed in #2095. @ is now an operator to concatenate symbols.

Unlike the other operators, lhs/rhs of @ is not a target of alias substitution.
'x' in 'x@y' doesn't look like a named variable, though it's technically
possible to allow definition of an alias expanded to a symbol of specific remote
or vice versa. This will probably apply to the kind:pattern syntax, where
aliases are expanded due to the current implementation restriction. I've added
a TODO comment about that.
2023-08-26 07:47:12 +09:00
Yuya Nishihara
8c2baafe5c revset: extract symbol parsing and resolution helper
These helpers will be used by name@remote handling.
2023-08-26 07:47:12 +09:00
Yuya Nishihara
81dda498e5 test_revset: rewrite resolve_symbol() to go through normal parse/resolve paths
I'm going to change the parsing rule of name@remote, and @ will no longer be
included in a symbol identifier. I could add a separate test for remote symbols,
but I think it's better to write tests that cover both "x"@"y" and "x@y" paths.
2023-08-26 07:47:12 +09:00
Martin von Zweigbergk
ab4d44df85 conflicts: leverage Merge::iter_mut() and Merge::into_iter() 2023-08-25 08:54:49 -07:00