ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/src
Martin von Zweigbergk 987aecc749 diff: add a type for diffing arbitrary number of inputs
I have been trying to figure out how to generalize diffs and merges
for arbitrary number of inputs. For example, I want to have an
internal representation of an octopus merge adding 5 inputs (file
states/contents) and removing 4 inputs. I also want to be to represent
a diff from a regular 3-way-conflict state to a resolved state. Such a
diff would be from a state adding two inputs and removing one, to a
state adding just one input.

I finally realized last week that the problem is simple if you don't
care about adds vs removes. Instead, you line up the matching and
differing parts of all the inputs. It's then up to the caller to use
it in an appropriate way for its use case. For example, a regular diff
would pass in two inputs and would get back a list of matching and
dffering hunks. It might then present the first element of differing
hunks in red and the second element in green. Similarly, a 3-way merge
would pass in three inputs with the base first. It would then compare
the sides and decide on a resolution (or leave it unresolved if all
three sides are different).

This change adds a type representing this kind of multi-way
diff. Coming changes will update existing code to use it. In addition
to making the existing code simpler and more consistent, having this
in place should also:

 * Make it much easier to present merge conflicts involving more than
   3 parts.

 * Experiment with different ways of displaying diffs from/to conflict
   states.

 * Experiment with sub-line-level merging.
2021-06-26 23:49:58 -07:00
..
commit.rs repo_path: replace remaining uses of DirRepoPath by RepoPath 2021-05-19 15:11:04 -07:00
commit_builder.rs repo: make MutableRepo have an Arc<ReadonlyRepo> instead of a reference 2021-04-11 13:42:31 -07:00
conflicts.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
dag_walk.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
diff.rs diff: add a type for diffing arbitrary number of inputs 2021-06-26 23:49:58 -07:00
evolution.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
file_util.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00
files.rs
git.rs cleanup: remove some Vec<_> annotations, mostly by using collect_vec() 2021-06-09 14:21:57 -07:00
git_store.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
gitignore.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
index.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00
index_store.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00
lib.rs windows: don't fail when concurrent threads/processes fail to rename file 2021-06-14 00:09:22 -07:00
local_store.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00
lock.rs tests: use one thread per core in concurrency tests 2021-04-29 00:01:04 -07:00
matchers.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
op_heads_store.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
op_store.rs cli: record full argv in operation log 2021-05-09 22:42:13 -07:00
operation.rs
protos.rs
repo.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
repo_path.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
revset.pest revsets: add "ancestor difference" range operator (like git's ..) 2021-04-23 19:10:28 -07:00
revset.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
revset_graph_iterator.rs revsets: remove transitive edges in graph iterator by default 2021-05-01 23:25:33 -07:00
rewrite.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
settings.rs cli: avoid using angle brackets in name/email placeholder, to please git 2021-05-19 13:02:39 -07:00
simple_op_store.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00
store.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
store_wrapper.rs repo_path: replace remaining uses of DirRepoPath by RepoPath 2021-05-19 15:11:04 -07:00
testutils.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
transaction.rs view: merge ReadonlyView and MutableView into a single View 2021-06-05 14:08:04 -07:00
tree.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
tree_builder.rs store: use RepoPathComponent in Tree 2021-06-05 23:36:38 -07:00
view.rs cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
working_copy.rs working_copy: consider it an error if temp file cannot be renamed to target 2021-06-16 10:52:55 -07:00