Friday, February 27, 2009

Fixing "svn: Checksum mismatch"

While trying to check in some changes I made, I ran into a problem that gave me the following error:

Transmitting file data .svn: Commit failed (details follow):
svn: Checksum mismatch for '/Users/jrice/workspace/eol-dev/spec/models/.svn/text-base/taxon_concept_spec.rb.svn-base'; expected: 'e4bd7ddf1f3c78447253dbdcd4ab96f6', actual: 'edbe4f2e08778a7d4f33212a812450ec'

...At first, I really freaked out, wondering if I had some kind of virus tacking on additional information to my files or something like that. But, of course, that was just panic. In truth, this is just a bad MD5 checksum in the svn database, and only for one file.  It's kind of a pain to fix, but it's simple enough.

I found a very nice walkthrough to fix it on Chris's Glob blog. For posterity, I will re-cap it here.  Start by committing everything you can (basically, everything but the one file that is having trouble).  Here's the rest of what I did, based on Chris's walkthrough:

$ cd /tmp
$ svn co
A    models/toc_item_spec.rb
A    models/taxon_concept_spec.rb
A    models/transactions_spec.rb
A    models/normalized_names_and_links_spec.rb
A    models/data_object_tag_spec.rb
A    models/hierarchy_spec.rb
A    models/user_spec.rb
A    models/factories_spec.rb
A    models/hierarchy_entry_spec.rb
A    models/name_spec.rb
Checked out revision 295.
$ cd -
$ cd ..
$ mv models /tmp/models.orig
$ mv /tmp/models .
$ svn up
At revision 295.
$ cp /tmp/models.orig/taxon_concept_spec.rb models
$ svn st
M      models/taxon_concept_spec.rb
$ svn commit -m "Adding specs to taxon_concept in prep. for xml API"
Sending        spec/models/taxon_concept_spec.rb
Transmitting file data .
Committed revision 296.

That's it: as you can see, the file went up just fine after that.