Subversion Checksum Problems

OK, so I didn’t quite make this up in one week, but I’ll keep trying. Here’s a tip for SVN users who get the dreaded “checksum mismatch” (usually by entirely replacing a file instead of editing it or something, actually I’m not quite sure what the exact cause is). There are already a couple workarounds on the Internet, but this one’s pretty clean.

  1. cp theFile theFile.bak
    Save your changes.

  2. svn info theFile | grep "Last Changed Rev"
    This is the last time the file changed in the repository; say it’s something like 6207.

  3. svn update -r6206 theFile
    Rollback the file to the previous version, in this case 6206.

  4. svn update theFile
    Restore the most recent version of the file. (I’m not sure if this step is purely necessary, but it doesn’t hurt.) This should fix the checksum.

  5. mv theFile.bak theFile
    Move the changed file back, and…

  6. svn commit

If you don’t use SVN, sorry, this post is not for you. Something more interesting next week, perhaps?