Created
December 6, 2013 15:39
-
-
Save mvidner/7826710 to your computer and use it in GitHub Desktop.
Assist in finding a minimal spanning tree of diffs among 4 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| filenames = ARGV | |
| # hardcoded for 4 vertices | |
| def all_pairs(v) | |
| [ | |
| [v[0], v[1]], | |
| [v[0], v[2]], | |
| [v[0], v[3]], | |
| [v[1], v[2]], | |
| [v[1], v[3]], | |
| [v[2], v[3]] | |
| ] | |
| end | |
| all_diffs = all_pairs(filenames).map do |a, b| | |
| `diff -u #{a} #{b}` | |
| end | |
| all_diffs.sort_by{|s| s.length}.each do |i| | |
| puts i | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment