real_diff.pl #!/usr/bin/perl use strict; use warnings; my $directory; if (!$ARGV[0]) { die "Usage: real_diff.pl directory_name\n"; } else { $directory = $ARGV[0]; } open(DIFF_FILE, "<", "$directory.txt") || die "There is no diff file f +or directory $directory\n"; my @lines = <DIFF_FILE>; close(DIFF_FILE); print "Now creating real diff file $directory.rl ...\n"; my $prev_line; my $current_file; open(REAL_DIFF, ">", "$directory.rl"); for (0 .. $#lines) { my $line = $lines[$_]; my $out_line = ""; for (my $i = 0; $i < length($line); $i ++) { if (substr($line, $i, 1) eq "\t") { $out_line .= " " x (8 - length($out_line) % 8); } else { $out_line .= substr($line, $i, 1); } } if ($out_line =~ m/^RCS file: (.*?),/) { $current_file = $1; } if ($out_line =~ m/^.{62}[<|>|\|]/) { if (!$prev_line || ($_ > $prev_line + 1)) { print REAL_DIFF "========================================= +=============================\n"; print REAL_DIFF "line number in $directory.txt: " , $_ + 1 +, "\n"; print REAL_DIFF "Source file name: $current_file\n\n"; } print REAL_DIFF $out_line; $prev_line = $_; } } close(REAL_DIFF);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extract useful infos from cvs diff output
by jmcnamara (Monsignor) on Jan 31, 2003 at 09:43 UTC | |
by pg (Canon) on Jan 31, 2003 at 16:12 UTC | |
|
Re: extract useful infos from cvs diff output
by Aristotle (Chancellor) on Jan 31, 2003 at 05:54 UTC | |
by pg (Canon) on Jan 31, 2003 at 06:46 UTC | |
by jeffa (Bishop) on Jan 31, 2003 at 13:35 UTC | |
by Aristotle (Chancellor) on Jan 31, 2003 at 13:48 UTC | |
by Aristotle (Chancellor) on Jan 31, 2003 at 13:06 UTC |