[SOLVED] svn user commits _svn folder !?!?!?

Names and paths changed to protect the innocent 🙂

Here’s a quick one that wreaked a moment of havoc. A user had comitted _svn folders to the repository. The build server uses _svn instead of .svn by way of an environment variable SVN_ASP_DOT_NET_HACK. This caused the continuous integration server to stop updating since it freaked out trying to pull down a _svn folder over a _svn folder.

This is what it looked like in the log:

PS J:\> svn log --verbose -r 1234 https://svnserver/svn/WidgetX/trunk
------------------------------------------------------------------------
r1234 | johnsmith | 2012-02-08 11:14:09 -0800 (Wed, 08 Feb 2012) | 1 line
Changed paths:
   A /trunk/src/newthing
   A /trunk/src/newthing/0.jpg
   A /trunk/src/newthing/1.jpg
   A /trunk/src/newthing/2.jpg
   A /trunk/src/newthing/9.jpg
   A /trunk/src/newthing/_svn
   A /trunk/src/newthing/_svn/prop-base
   A /trunk/src/newthing/_svn/props
   A /trunk/src/newthing/_svn/text-base
   A /trunk/src/newthing/_svn/tmp
   A /trunk/src/newthing/_svn/tmp/prop-base
   A /trunk/src/newthing/_svn/tmp/props
   A /trunk/src/newthing/_svn/tmp/text-base
Just another commit
------------------------------------------------------------------------

To fix a user comitting _svn folders:

# My environment variable was set so checkouts use _svn instead of .svn (legacy reasons)
# Unset it so we get .svn folders as normal
$env:SVN_ASP_DOT_NET_HACK=$null
# Checkout the branch so we get a working copy with .svn instead of _svn as usual
svn co https://svnserver/svn/WidgetX/trunk
# Round up the offending _svn folders and delete them!
get-childitem -recurse -force | where { $_.name -eq "_svn" } | foreach {  svn delete ""$_.fullname"" }
svn commit -m "Cleaning up _svn folders" trunk

I tried to reproduce this scenario using .svn folders, but svn smartly told me it was a reserved name. Adding _svn it didn’t complain at all (see bug). There might be some way to force a .svn folder in, in which case you can use this procedure except set the SVN_ASP_DOT_NET_HACK variable to any value instead of unsetting it. Also change $_.name -eq “_svn” to $_.name -eq “.svn”.

This entry was posted in General and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *