views:

25

answers:

0

Are there any tools which can perform set operations (union, intersection, difference, etc) on diffs?

For example, if I've got two diffs that overlap (ie, contain hunks with identical changes), I'd like to be able to do things like "get all hunks which are only in one diff" or "get all hunks which are common to both diffs".

For example, given the two diffs A and B:

$ cat A.diff
@@ ... @@
+ foo
- bar
@@ ... @@
+ baz
$ cat B.diff
@@ ... @@
+ foo
- bar
@@ ... @@
+ bam

One of the things I'd like to be able to see is:

$ diff_symetric_difference A.diff B.diff
@@ ... @@
+ baz
@@ ... @@
+ bam
$ diff_subtract A.diff B.diff
@@ ... @@
+ baz

I most often want this when I'm doing code reviews (eg, because I've reviewed diffs A and C, so I would like to see changes A..D - A - C).