Subversion Checksum Mismatch Workaround
This post relates to Subversion, a version control system. This is used most commonly in programming to allow multiple programmers to work on the same set of files at the same time without stepping on each other’s toes. It also lets you “roll back” your code to any point in time, so if you screw something up, it’s ultra easy to go back to the point before that.
Some writers also use this sort of things to keep copies of their writing, and then if they change/remove something that they later decide they shouldn’t have, it’s easy to peek back at what it was like.
Anyway, sometimes when dealing with Subversion, you might get an error like this when trying to run svn update:
svn: Checksum mismatch for ‘/path/to/repository/.svn/text-base/some-file.php.svn-base’; expected: ‘e5b110ec4409891e81f38203d45e4f5d’, actual: ‘c84a851f87b9b62934b44adc457dcfd0′
There are two fixes for this. The first is to just delete the directory containing the code where the checksum mismatch is (including the .svn directory below it), and run svn update again from one directory up. But if, like me, the checksum mismatch is in the base directory and it’s inconvenient to do that*, there is another solution. Basically you will check out a fresh copy of the affected directory, and copy over the SVN file with the checksum error.
- Check out a new copy of the repository in some other directory. If the problem is in a subdirectory, you only have to check out that subdirectory.
- Rename the file mentioned above (the one with the checksum error, /path/to/repository/.svn/text-base/some-file.php.svn-base in this example) to add -bak on the end of it. It’s always good to have a backup.
- Copy that file from the working copy you created in step 1 to your “real” repository location.
- Run svn update to see if it works. If not, make sure that in step 3 you copied the file to the correct directory (it needs to go under the .svn/text-base/ directory).
- Once that works, you can delete the other working copy you checked out, as well as the -bak file you created.
I’m putting this here in the hopes that Google will index this, and someone else with the same problem might find it useful.
* In my case, I have a lot of images and other things that need to be there, but that aren’t in the SVN repository, so just wiping it out and checking out a whole new working copy of the repository doesn’t really work.