Commit graph

3400 commits

Author SHA1 Message Date
Kevin Liao
44f3cff219 Fix invalid code link 2023-06-09 07:51:52 +02:00
Martin von Zweigbergk
81aa90efd3 merge_tools: leverage ok_or_else() instead of pattern matching 2023-06-07 13:45:16 -07:00
Martin von Zweigbergk
fb3f8b3bd3 merge_tools: check complexity of conflict before reading content
We can know before we read the content if the conflict is too complex
for a merge tool to resolve.
2023-06-07 13:45:16 -07:00
Martin von Zweigbergk
de71df2447 conflicts: move conversion to FileId conflict to callers
This simplifies a bit, in particular by removing the error case from
`extract_file_conflict_as_single_hunk()`.
2023-06-07 13:45:16 -07:00
Martin von Zweigbergk
ad667d6bb5 conflicts: convert TreeValue to FileId conflict to avoid panic!
By converting a `Conflict<Option<TreeValue>>` to a
`Conflict<Option<FileId>>`, we don't have to check later that
`TreeValue` really is a `File`.
2023-06-07 13:45:16 -07:00
Martin von Zweigbergk
ddb07e639c merge_tools: simplify error message for complex conflicts
Since e48ace56d1, the number of adds in the hunk is always exactly
one more than enumber of removes, so we can simplify the condition and
the error message accordingly.
2023-06-07 13:45:16 -07:00
Martin von Zweigbergk
4a0fa4d9a0 cli: simplify calculation of number of sides of conflict
The number of adds (including `None` terms) is now the number of
"sides".
2023-06-07 13:45:16 -07:00
Ilya Grigoriev
337544cf96 No-op clarification of import_export tests 2023-06-07 13:42:48 -07:00
Ilya Grigoriev
fa1e961f53 jj debug operation --display id option to show current operation id for tests
I also considered `jj operation id`, but I'm not sure this is useful outside tests
2023-06-07 13:42:48 -07:00
Ilya Grigoriev
14e19d0692 cmd: move debug commands to a separate debug.rs file
This follows #1061 for consistency. The resulting file is of a similar size to
operation.rs.
2023-06-07 13:42:48 -07:00
Waleed Khan
74b846870c feat(diff): add ui.diff-instructions option to suppress JJ-INSTRUCTIONS file 2023-06-06 22:43:14 -07:00
dependabot[bot]
8f9d72c028 cargo: bump clap from 4.3.1 to 4.3.2
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.1 to 4.3.2.
- [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.3.1...v4.3.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-06 17:19:06 +00:00
dependabot[bot]
0c36b1ad4e cargo: bump libc from 0.2.145 to 0.2.146
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.145 to 0.2.146.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.145...0.2.146)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-06 10:02:08 -07:00
dependabot[bot]
06cd6fbc4e cargo: bump libc from 0.2.144 to 0.2.145
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.144 to 0.2.145.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.144...0.2.145)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-05 16:25:42 +00:00
dependabot[bot]
eb1fafa89e cargo: bump once_cell from 1.17.2 to 1.18.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.2 to 1.18.0.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.17.2...v1.18.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-05 16:22:45 +00:00
dependabot[bot]
4b0b98a3da cargo: bump regex from 1.8.3 to 1.8.4
Bumps [regex](https://github.com/rust-lang/regex) from 1.8.3 to 1.8.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.8.3...1.8.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-05 16:11:29 +00:00
Waleed Khan
23a4124d20 feat(revset): suggest similar branch names 2023-06-05 11:11:17 -05:00
Waleed Khan
f61cbae022 refactor(revset): move collect_similar from cli_util to revset 2023-06-05 11:11:17 -05:00
Waleed Khan
0fff404fb2 cleanup: fix clippy issues 2023-06-05 11:11:17 -05:00
Martin von Zweigbergk
7f3d07e35f cli: add jj git push -r for pushing branches pointing to revset
I think I will find this useful in at least two cases:

1. When you already have a branch pointing to some commit, it's easier
   to do `jj git push -r xyz` than `jj git push --branch
   push-xyzxyzyxzxyz`.

2. When you have a stack of changes, it's useful to be able to push
   all of them at once.

I think we should also update the default behavior of `jj git push` to
be `jj git push -r 'remote_branches()..@'` or something like
that. That removes the ugliness of having a default behavior that the
user can't reproduce using flags. I'll leave that change for a
separate PR.
2023-06-04 20:50:11 -07:00
Martin von Zweigbergk
9f7180ff55 cli: use | for combining a few match patterns 2023-06-04 20:50:11 -07:00
Martin von Zweigbergk
abcfebf1e2 cli: allow jj git push --change xyz --branch foo
This was pretty simple. I simplified a bit by making the transaction
description mention only branches, not changes. It still mentions the
branches created for the changes, however. Also, since the operation
"tags" contain the full command line, I think it'll still be
relatively easy for the user to understand what the operation was
about.
2023-06-04 20:50:11 -07:00
Martin von Zweigbergk
ac8313f119 cli: in jj git push, create transaction in a single place
I added a function for updating the description on an existing
transaction. That way we can create the transaction earlier. I'll try
to make `--change` and `--branch` not mutually exclusive next.
2023-06-04 20:50:11 -07:00
Ilya Grigoriev
d82266887c SECURITY.md: show the email plainly
Previously, the link wasn't working from Github's rendered markdown.

Another alternative is to add `malto:` to the link, which would make it work. However, I thought that since the email is the most important piece of information in the entire file, we should just write it out.
2023-06-04 17:03:25 -07:00
Martin von Zweigbergk
29b676f24f store: do conversion to/from backend::Conflict
We now convert to/from `backend::Conflict` right before/after calling
the `Store` methods, so we can simplify by having the `Store` do the
conversion.
2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
594734dbc9 cli: replace use of backend::Conflict when listing paths with conflicts 2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
43c55fcbc9 tree: replace uses of backend::Conflict 2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
c378503991 conflicts: replace remaining uses of backend::Conflict 2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
9907cccf37 conflicts: use an early return to reduce indentation
Thanks to @ilyagr for the suggestion.
2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
f4499aa65e conflicts: fix bug when modifying modify/delete conflicts
Currently, if the user modifies a modify/delete conflict, we always
consider the result resolved. That happens because we materialize the
missing side of the conflict as an empty string but when we parse the
conflict, we expect only the number of sides in the input
conflict. For example, if the input is a regular modify/delete
conflict with one remove and one add, the materialized markers will
have one remove and two adds (one of them empty), but when we try to
parse it, we expect one remove and only one add. When we fail to parse
it, we consider it resolved.

This commit fixes the bug by using
`conflicts::Conflict<Option<TreeValue>>` and keeping track of which
sides were supposed to be empty. We could have fixed the bug without
switching to `conflicts::Conflict`, but we want to switch anyway, and
the fix happens naturally when switching.
2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
1fdc25fe45 conflicts: replace backend::Conflict in materialize_conflict() 2023-06-04 06:48:34 -07:00
Martin von Zweigbergk
5733e3a442 conflicts: introduce generic type for conflicts
For support for tree-level conflicts (#1624), I'm probably going to
introduce a `MergedTree` type representing a set of trees to
merge. That will be similar to `Tree`, but instead of having values of
type `TreeValue`, it will have values that can represent a single
state or a conflict. The `TreeValue` type itself will eventually lose
its `Conflict` variant.

To prepare for that, this commit introduces a `Conflict<T>` type. That
type is intended to be close to what the future
`MergedTree::path_value()`, `MergedTree::entries()`, etc. The next few
commits will replace most current uses of `backend::Conflict` by this
new `conflicts::Conflict` type. They will use `Option<TreeValue>` as
type parameter. Unlike the current `backend::Conflict` type, the
explicit tracking of `None` values will let us better preserve the
ordering and tying it to the tree-level conflict's order.
2023-06-04 06:48:34 -07:00
Yuya Nishihara
78a64edb22 dag_walk: rename bfs() to dfs() because it's depth-first
No callers appear to rely on traversal order, so let's just fix the function
name. Maybe it was a typo.
2023-06-04 11:47:49 +09:00
Yuya Nishihara
d5d1dbcd3e dag_walk: reorder and adjust signature of neighbors_fn for consistency 2023-06-04 11:47:49 +09:00
Yuya Nishihara
a28e672633 dag_walk: unbox topo_order_reverse() callback 2023-06-04 11:47:49 +09:00
Yuya Nishihara
3ba544414c dag_walk: unbox bfs() callback, use iter::from_fn() to implement iterator
I just wanted to remove syntactic noise from callers. iter::from_fn() helps
to avoid declaring struct with lots of type parameters.
2023-06-04 11:47:49 +09:00
Yuya Nishihara
522308bb9c dag_walk: simply pass callback function by value 2023-06-04 11:47:49 +09:00
Martin von Zweigbergk
864c17b8c4 changelog: consider renamed jj debug commands a breaking change
I think I originally didn't consider changing debug commands as a
breaking change, but it's better to be conservative.
2023-06-03 19:21:43 -07:00
Martin von Zweigbergk
e86f339863 changelog: removing the jj hide alias is a breaking change 2023-06-03 19:21:43 -07:00
dependabot[bot]
60812f8346 cargo: bump clap from 4.3.0 to 4.3.1
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.0 to 4.3.1.
- [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.3.0...clap_complete-v4.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-02 16:23:30 +00:00
dependabot[bot]
2ca42ada12 cargo: bump clap_complete from 4.3.0 to 4.3.1
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.3.0 to 4.3.1.
- [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.3.0...clap_complete-v4.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-02 16:11:16 +00:00
Yuya Nishihara
6872051270 tree_builder: populate base trees by recursion
Suppose many override entries share the same parent directories, it should
be cheaper to look up the tree_cache from leaf than root. I also think
recursion is easier to follow than for loop.
2023-06-02 12:23:37 +09:00
Yuya Nishihara
941f41e62e tree_builder: initialize base trees with the root entry
This helps to rewrite populate_trees() as recursive function call.
2023-06-02 12:23:37 +09:00
Yuya Nishihara
7cf96bcae0 tree_builder: ensure override file path never points to root tree 2023-06-02 12:23:37 +09:00
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