TortoiseSVN – What’s the point of Clean Up and why doesn’t it work?

This was a question I got from a colleague today. 

In my experience (which certainly isn’t exhaustive) a clean up is required when I’ve done something that svn didn’t expect.  Typically this is where I’ve manipulated files on my own without using the TortoiseSVN tools.  Eventually they get in such a state that svn simply doesn’t know how to resolve things.  One example comes to mind where I have deleted my .svn folder in a directory.  Now, according to svn, that directory is suddenly missing and an unversioned directory of the exact same name exists, and therefore cannot be replaced.

In many cases the Clean Up tool can fix simple mistakes, but in the example above svn simply needs help.  If I can’t fix what’s going on then I’ll typically just delete the entire project folder and check out a brand new copy.  This is usually far faster than actually trying to fix what went wrong.  If I have made changes that I don’t want to loose then I check out the project into a brand new directory, add the changes to that version (either through VS 2008 or by just manually dragging over files) and do any manipulation such as renames, deleted, etc with Tortoise-svn.

Just yesterday I was working with an SSRS 2005 project.  Our set of reports had grown over time so we decided to organize them into folders.  VS 2005 cannot do this.  Our strategy was to create one solution for the set of reports, containing a separate project for each subgroup.  This really helped organize everything, but there was no simple way to do this using VS 2005 and svn.  Either we create the new projects and moverename all the reports between projects using VS 2005, and svn was totally lost, or we did everything in svn, which confused VS 2005 and ultimately broke a lot of links.

I decided on the first option, to simply do it all in VS 2005 then commit the changes in svn.  svn reported a lot of missing files and a lot of unversioned files after the change but I just marked the missing ones as deleted and committed the unversioned ones.  While I technically lost the history in svn of the development of the files I have rarely needed to view changes past a few revisions and I think any intelligent person can see what we did.

Technorati Tags: ,

Searching for a past committed file in SVN

Recently a colleague asked me how to search for a file in SVN. Apparently someone on the team had deleted it and then committed the project. Unfortunately no one knew who or when and it was now causing a problem.

If you use TortoiseSVN there is a really great way to get a lot of information on your revisions, including searching for files.

Simply right-click on the project folder (not the repository folder), go to the TortoiseSVN menu and click Show Log.


This will bring up a log browser for every revision on the project. You can select a revision in the top pane, see the log messages in the middle pane and all files modified for that particular revision in the bottom pane.

What’s even better is on the top right is a search textbox.


My friend typed the name of the file in the textbox and voila! Any revision that had an action on that file showed up. They were able to easily find out exactly when the file was deleted and who deleted it.

<promotion author:self type:shameless>

I’ll be doing a quick intro on using SVN and TortoiseSVN at the IE .Net User’s Group in Riverside on July 8th. If you’ve ever wondered about using SVN or version control in general stop on by!