Svn – Restoring Subversion repositories from backup

svntortoisesvn

I had to restore a subversion server from a backup image taken the previous night. Everything worked fine after the restore except for one repository.

A working copy had been committed on the server after the latest backup, so this working copy had newer files than the restored repository. I tried to commit the files using tortoise, but SVN didn't recognize that the files on the working copy were newer than those in the repository.

I'm using Subversion Server 1.6.5 on Windows 2003 Server and TortoiseSVN 1.6.8 64 bit on a Win7 64 bit client.

Thanks,
John

Best Answer

This is because SVN uses a local 'cache' of the working copy files to decide what is different from the repository (so it doesn't have to contact the repo, to fetch the file, to diff it, just to find out that you've changed it).

In this case, that isn't working as you want as the working copy (and its cache) is out of sync with the repo. When you change those file and commit them, then you'll find that SVN will re-sync itself (and throw a 'whats going on' error no doubt).

So, you need to re-sync the working copy cache manually. First, take a copy of the working copy directory without the cache - ie the .svn directories. (search for .svn using the old Windows Search doggie and delete all those directories)

Then update the directory to fetch the current status of the repo, I think SVN will update the cache and will merge your local changes to the files in the repo, so you will be back to normal - ie the changed files will get the 'modified' icon, and then you can commit the changes. I'm pretty sure this is what will happen, but I'm always paranoid about losing data after a restore which is why you will first make the copy. If anything goes wrong, you can just overwrite the files fetched from the repo with your old WC, and it'll show as modified. commit as normal.