Re: rename_rev.pl script for reviewing renames
From: Wolfram Sang
Date: Thu Feb 03 2011 - 05:22:25 EST
On Thu, Feb 03, 2011 at 01:08:28PM +0300, Dan Carpenter wrote:
> There are a lot of refactoring patches where people change camel case
> names to kernel style names etc. I've written a script to make it
> easier to review them. It's attached.
Cool, thanks for sharing. I guess my comments won't matter much, here
they are anyway :)
> sub usage() {
> print "cat diff | transform.pl old new old new old new...\n";
Filename of the tool does not match.
> # white space at the end of lines
> $line =~ s/ *$//g;
> $line =~ s/\t*$//g;
Character class here as well? Will also get mixtures of the two.
> while (<>) {
> my $line = $_;
You could work here with plain $_, but I assume you don't do on purpose.
>
> if ($line =~ /^---/) {
> next;
> }
> if ($line =~ /^\+\+\+/) {
> next;
> }
Use an alternation in the regexp?
> my $output = filter($line);
> if ($line =~ /^-/) {
> print $oldfh $output;
> next;
> }
> if ($line =~ /^\+/) {
> print $newfh $output;
> next;
> }
Ditto.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Attachment:
signature.asc
Description: Digital signature