Converting _svn to .svn
Back in the day, Visual Studio 2003 had a bug which made it behave poorly if there were folders or files in a project which started with a dot in their file names.
Ever since, TortoiseSVN had support for ‘_svn’ folders. This problem was fixed in Visual Studio 2005, but the folders stayed. I found this to be a problem when I started using Ruby because svn client itself doesn’t play well with ‘_svn’ folders.
To help with the problem I wrote a little Ruby script which simply goes through every folder starting from your current one and renames every ‘_svn’ to ‘.svn’.
First, if you don’t already have, install Rio gem, which is a wonderful IO library.
gem install rio
Then open and drop svnrename.bat into your \Rails\bin folder. Then open cmd prompt and go to your desired folder, type svnrename and you are done.
Here’s what the file looks like:
"%~d0%~p0ruby" -x "%~f0" %*
goto endofruby
#!/bin/ruby
require 'rio'
dir = ARGV[0]
dir = '.' if dir.nil?
count = 0
rio('.').all.rename.dirs('_svn') do |d|
count += 1
puts d
d.basename = '.svn'
end
puts "Nothing found" if count == 0
__END__
:endofruby
This was one of my very first Ruby utilities. So…
No comments yet, be the first one!
Leave a Reply