Messages in this thread | | | Date | Thu, 3 Feb 2011 11:22:19 +0100 | From | Wolfram Sang <> | Subject | Re: rename_rev.pl script for reviewing renames |
| |
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/ | [unhandled content-type:application/pgp-signature] | |