Saturday, May 26, 2012

SVN commit problem: no working copy

During developing I often use SVN as CVS. However, sometimes when trying to commit I get an error message stating that a specific folder/file is no working copy which leads to a failure of the commit process.

But don't worry: it is easy to fix in a few steps:

  1. Create a copy of the affected folder and move it to somewhere outside your working copy.
  2. Clear the copied folder of all SVN-references (e.g by deleting all .svn folders).
  3. SVN-delete the affected folder (either be SVN CLI or from the context-menu when using tools like Tortoise/Rabbit-SVN) - if the folder contains subfolders make sure to also SVN-delete these as the SVN-delete command is not recursive.
  4. Commit the deleted (and only the deleted!) folder.
  5. Delete the folder from the filesystem.
  6. Copy the aforementioned copied folder back into the working copy.
  7. SVN-add the folder.
  8. Commit.
That should make sure, that you're working copy is usable again. Another way would be to just SVN-revert the folder to the last revision, but thus you would loose all changes you've made since the last commit/update.

Monday, May 14, 2012

How to properly restore a backed-up Eclipse workspace

This morning my Ubuntu crashed while I was working in Eclipse. Unfortunately this also corrupted my workspace state. But, no problem - I had a backup. However, restoring the backup wasn't as easy as I had thought...

I had backed up my home partition with deja-dup - the built in backup solution in Ubuntu. After the recovery deja-dup's status dialog gave me quite a few error messages stating that SVN related files couldn't be restored due to missing permissions. I assume, this was due to the fact, that rabbitcvs, the tool I access my SVN repositories with besides Eclipse, still was holding locks on these files.

Stopping rabbitvcs's status checker service didn't help. So I fired up deja-dup's recovery dialog again by right clicking on the folder and choosing the "Revert to previous version..." entry. After the dialog appeared (and deja-dup knew the path of the folder it should recover) I renamed the workspace folder (could also have deleted it, but just in case...) and let deja-dup do it's job. And guess what, it worked! As deja-dup doesn't seem to just restore the changed files, but everything, that is under the marked folder, there is also no performance loss in acting like this.

"Easy-peasy!" you may shout out now, but for me it took nearly 10 minutes to work this out.