#!@PERL5@ # # $NetBSD: patchdiff.pl,v 1.10 2008/11/05 23:18:18 wiz Exp $ # # patchdiff: compares a set of patches patch-aa, patch-ab, ... in # $WRKDIR/.newpatches in the with another set in patches. # # Copyright (c) 2000 by Dieter Baron and # Thomas Klausner # All Rights Reserved. Absolutely no warranty. use Getopt::Std; use Cwd; use File::Spec; my $oldpatchdir, $newpatchdir; my $wrkdir, $thisdir; my %orig, %new; sub getfilename { my $fname=shift; local $_; local *handle; open(handle, $fname); while () { next unless m/^\+\+\+[ ]([^ ]*)/; close(handle); $_ = $1; chomp(); s/^\.\///; # ignore leading "./", if any. return $_; } close(handle); return undef; } sub putinhash { my $hash=shift; my $files=shift; my $temp; local *handle; open(handle, "ls $files|"); while() { chomp; $temp=getfilename($_); $$hash{$temp}=File::Spec->abs2rel($_, $thisdir); } close(handle); } getopts('d:h'); if ($opt_h) { ($prog) = ($0 =~ /([^\/]+)$/); print STDERR < --- something.orig 2008-08-08 18:08 # # In particular, remove hunks with: # . NetBSD RCS Id tag differences $diff=~s/^\d+c\d+\n..\$[N]etBSD.*\$\n---\n..\$[N]etBSD.*\$\n//m; # . only the name or date of the output file changed $diff=~s/^\d+c\d+\n..\+\+\+.*\n---\n..\+\+\+.*\n//m; # . only the name or date of the input file changed $diff=~s/^\d+c\d+\n.\s---\s.*\.orig\s.*\n---\n.\s---\s.*\n//m; $diff=~s/^\d+c\d+\n.\s---\s.*\n---\n.\s---\s.*\.orig\s.*\n//m; # . only line numbers changed $diff=~s/^\d+c\d+\n.\s@@\s.*\s@@.*\n---\n.\s@@\s.*\s@@.*\n//mg; if ($diff) { print "Comparing $orig{$patch} to $new{$patch}\n$diff"; } } else { print "Only in new: $new{$patch} ($patch)\n" } }