For Blobs we print:
```
- Blob (42 kB)
+ Blob (1 B)
```
For Refs we just print the hashes:
```
- abcdeabcdeabcdeabcde
+ defghdefghdefghdefgh
```
Fixes#2213
Earlier I'd used 2 channels and selected over them, but as I found
elsewhere, this doesn't scale very well. It's simpler to just use a
close channel with a buffer size of 1.
Shows number of changes between two top level values.
```
noms diff -summarize $l::#t5p4im6uug7n5m72frr0dnjnkm04e4ph.value $l::#ueo0utduuqsf9vrntrhn25lnc19m848l.value
```
Prints:
```
13,636 insertions, 0 deletions, 107 changes, (1,919,894 values vs 1,933,530 values)
```
Where the numbers are updated as more data is computed from the diff.
Towards #2031
- Too have same API as all the other diff methods
- Send changes to channel without intermediary slices and without the
need to union and sort the fields
Previously a header was only printed once per entire map. This led to a
confusing diff where if a map like:
```
{
"a": {
"b": 1
}
}
```
changed to:
```
{
"a": {
"b": 2
},
"c": {
"d": 3
}
}
```
then the diff would be:
```
/["a"]
- "b": 1
+ "b": 2
+ "c": {
+ "d": 3
+ }
```
which makes it look like the "c" change is part of the ["a"]["b"] one.
After this change, the diff will be:
```
/["a"]
- "b": 1
+ "b": 2
/
+ "c": {
+ "d": 3
+ }
```
I also fixed up a bit of the diff formatting in this change.
This changes so that all commit struct types have a meta field
(which might be an empty struct).
Increment the serialization version since the old data does not
necessarily have the meta field.
Fixes ##2112
Currently they return immediately, but run internal goroutines which
stream results back on a channel. Now they must be run on their own
goroutine from outside the function.
This makes the code easier to reason about, and a future patch to write
a top-down and left-right multiplexing diff easier to write.
We now compute the commit type based on the type of the value and
the type of the parents.
For the first commit we get:
```
struct Commit {
parents: Set<Ref<Cycle<0>>>,
value: T,
}
```
As long as we continue to commit values with type T that type stays
the same.
When we later commits a value of type U we get:
```
struct Commit {
parents: Set<Ref<struct Commit {
parents: Set<Ref<Cycle<0>>>,
value: T | U
}>>,
value: U,
}
```
The new type gets combined as a union type for the value of the inner
commit struct.
Fixes#1495