Package patchutils provides tools to compute the diff between source and diff files.
Works with diff files in unified format.
InterDiff computes the diff of a source file patched with oldDiff and the same source file patched with newDiff, without access to the source.
Example
oldDiff | newDiff |
---|---|
@@ -1,10 +1,13 @@
80 days around the world.
-We’ll find a pot of gold
+You’ll find a pot of gold
just sitting where the rainbow’s ending.
+Top Cat! The most effectual Top Cat!
+Who’s intellectual close friends get to call,
+providing it’s with dignity.
+The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind.
-80 days around the world,
-no we won’t say a word before
the ship is really back. |
@@ -2,9 +2,13 @@
We’ll find a pot of gold
just sitting where the rainbow’s ending.
+There’s a voice that keeps on calling me.
+Who’s intellectual close friends get to call,
+providing it’s with dignity.
+The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind.
-80 days around the world,
no we won’t say a word before
the ship is really back. |
result | |
@@ -1,8 +1,8 @@
80 days around the world.
+We’ll find a pot of gold
-You’ll find a pot of gold
just sitting where the rainbow’s ending.
-Top Cat! The most effectual Top Cat!
+There’s a voice that keeps on calling me.
Who’s intellectual close friends get to call,
providing it’s with dignity.
The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind.
+no we won’t say a word before
the ship is really back. |
MixedMode computes the diff of an oldSource patched with oldDiff and newSource patched with newDiff.
Example
oldSource | newSource |
---|---|
|
|
oldDiff | newDiff |
@@ -4,6 +4,7 @@
Top Cat! The most effectual Top Cat!
Who’s intellectual close friends get to call,
+Round, round, all around the world.
providing it’s with dignity.
The indisputable leader of the gang. |
@@ -5,7 +5,6 @@
There’s a voice that keeps on calling me.
Who’s intellectual close friends get to call,
providing it’s with dignity.
-The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind. |
oldSource + oldDiff | newSource + newDiff |
80 days around the world.
You’ll find a pot of gold
just sitting where the rainbow’s ending.
Top Cat! The most effectual Top Cat!
Who’s intellectual close friends get to call,
Round, round, all around the world.
providing it’s with dignity.
The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind.
the ship is really back. |
|
result | |
@@ -1,14 +1,13 @@
80 days around the world.
-You’ll find a pot of gold
+We’ll find a pot of gold
just sitting where the rainbow’s ending.
-Top Cat! The most effectual Top Cat!
+There’s a voice that keeps on calling me.
Who’s intellectual close friends get to call,
-Round, round, all around the world.
providing it’s with dignity.
-The indisputable leader of the gang.
Time — we’ll fight against the time,
and we’ll fly on the white wings of the wind.
+no we won’t say a word before
the ship is really back. |
go get -u github.com/google/go-patchutils
Godoc is available.
Build CLI tool
cd cli
go build
Interdiff mode
./cli interdiff -olddiff=<path_to_old_diff> -newdiff=<path_to_new_diff>
Mixed mode
./cli mixed -oldsource=<path_to_old_source> -olddiff=<path_to_old_diff>
-newsource=<path_to_new_source> -newdiff=<path_to_new_diff>