#!/usr/bin/perl -w # ### specify remove prefix my $prefix = shift @ARGV; $prefix =~ s!/*$!/!; ### state machine sub INIT {1}; sub WAIT_ORGREV {2}; my $state = INIT; ### search regex my $new_orgrev='^\+[-) { chomp; #print "$state: $_\n"; if (m!$index!) { printf "\t%s\n",$target if ($state eq WAIT_ORGREV); $target = $1; $target =~ s/^\Q$prefix// if ($prefix); $oldrev = undef; $newrev = undef; $state = WAIT_ORGREV; } elsif ($state eq WAIT_ORGREV) { m/$old_orgrev/ and do { $oldrev = $1; }; m/$new_orgrev/ and do { $newrev = $1; }; if ($oldrev and $newrev) { $state = INIT; printf "\t% -5s -> % -5s\t%s\n",$oldrev,$newrev,$target; } } } if ($state eq WAIT_ORGREV) { printf "\t%s\n",$target; } print "\n"; print "PR:\t\n"; print "Approved by:\t\n"; print "Obtained from:\t\n"; print "Pointed out by:\t\n"; print "Submitted by:\t\n"; print "Reviewed by:\t\n"; print "References:\t\n";