Revision 3740

Date:
2019-10-25 04:11:57
Author:
dsb
Revision Log:
Harden this up a bit and check it in so we we can pull it out as an
external in ^/addons: a utility script for comparing corresponding files
or directories from different versions. Can check forward or backward
depending on presence of /tmp/tome-prev-foo vs. /tmp/tome-new-foo unpacked
directories.
Files:

Legend:

 
Added
 
Removed
 
Modified
  • tome2/trunk/vdiff.pl

     
    1 #!/usr/bin/perl -w
    2 # $Id$
    3
    4 die "usage: $0 <file>\n" if scalar @ARGV != 1;
    5
    6 my $basefile = $ARGV[0];
    7 $basefile =~ s#/tmp/tome-(?:new|prev)-#/tmp/tome-#;
    8 my ($prevfile, $betafile) = ($basefile, $basefile);
    9 $prevfile =~ s#/tmp/tome-#/tmp/tome-prev-#;
    10 $betafile =~ s#/tmp/tome-#/tmp/tome-new-#;
    11
    12 -e $basefile or die "$basefile does not exist\n";
    13 -e $prevfile or -e $betafile or die "Neither $prevfile nor $betafile exist\n";
    14 my ($oldfile, $newfile);
    15 if (-e $prevfile) {
    16 ($oldfile, $newfile) = ($prevfile, $basefile);
    17 }
    18 else {
    19 ($oldfile, $newfile) = ($basefile, $newfile);
    20 }
    21
    22 my $opt = '-ub';
    23 $opt .= 'r' if -d $basefile;
    24 exec "diff $opt $oldfile $newfile |less";