jj/lib
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
..
benches project: rename project from Jujube to Jujutsu 2021-05-15 10:28:40 -07:00
protos cli: record full argv in operation log 2021-05-09 22:42:13 -07:00
src diff: add a type for diffing arbitrary number of inputs 2021-06-26 23:49:58 -07:00
tests cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
build.rs rustfmt: configure to group imports 2021-03-14 10:46:25 -07:00
Cargo.toml cargo: point test-case dependency to my fork 2021-06-23 17:07:51 -07:00