Skip to content

google/go-patchutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-patchutils GoDoc Go Report Card

Package patchutils provides tools to compute the diff between source and diff files.

Works with diff files in unified format.

Table of contents

Design

Interdiff mode

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.

Mixed mode

MixedMode computes the diff of an oldSource patched with oldDiff and newSource patched with newDiff.

Example
oldSource newSource
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,
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.
80 days around the world.
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.

no we won’t say a word before
the ship is really back.
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.
80 days around the world.
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.

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.
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.

Installation

go get -u github.com/google/go-patchutils

Usage

API

Godoc is available.

CLI tool

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>

About

go-patchutils is a library written in Go to show differences in source and diff files.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages