views:

60

answers:

3

Hi all,

I just ran a perl script to replace all occurances of one word for another for my whole project.

ie:

perl -e "s/OLD/NEW/g;" -pi $(find ./ -type f)

I want to commit these changes to subversion, but when i run "svn status", none of the modified files appear on the list.

The same thing occurs in TortoiseSVN using the "Check for modifications".

Did this perl script bypass some method that SVN uses to check for changes somehow?

+14  A: 

Your script operated on the local svn backup copies in the .svn folder. That's what svn uses to compare changes.

James Roth
Excellent diagnosis!
Greg Hewgill
Oops! Good catch... is there any way to reverse this at this point?
Will
You should check the project out again. Once you've messed with those files, all bets are off.
James Roth
gotta love svn :D
knittl
SVN was designed so that a network connection is not required for diff and other common tasks. Hence the local duplicate files that were changed here.
James Roth
A: 

It could have happened that your perl script changed the subversion files...

ssegvic
+3  A: 

You need to make that command:

perl -e "s/OLD/NEW/g;" -pi $(find ./ -type f | grep -v '/\.svn/' )

That grep command is so common on my commands that grep through subversion directories.

Axeman
You might want to look at [`ack`](http://betterthangrep.com/) which knows how to do this sort of thing for a variety of source control systems. Also, it's a great utility for searching through code.
Greg Hewgill
I would second the use of ack, but if you are set on using find your better off using the power of find instead of post filtering the results with grep. find is perfectly capable of skipping .svn directories entirely, saving you the time of recursing into them and then culling them out with grep. `find ./ -name .svn -prune -or -type f -print`
Ven'Tatsu
I don't think this command will work correctly if some file names contain spaces.
James Roth