Thursday, December 3, 2009

How to Fix svn: Directory __DIR__ containing working copy admin area is missing (and other misc SVN shortcuts)

So, you have a directory called myclass, you've added the directory to SVN, and then you issue a commit. During the commit, you get a message saying either a file is outdated, or a directory already exists that causes this commit to fail. No big deal right? So you fix those issues and try to commit again... Only this time, you get a totally different error that can cause a pretty ugly headache when you're trying to solve it.

Problem: svn: Directory 'myclass' containing working copy admin area is missing (and other misc SVN shortcuts)

Solutions
1) You could try and "checkout" the whole project again with the command svn co http://svn.mydomain/my_project/ my_project. This works for some, but in the case above, it may or may not work...

2) You could try and "checkout" only the folder that's having the issues into a temporary directory, then move the .svn folder into the SVN controlled directory where your project lives with the commands:
svn co http://svn.mydomain/my_project/myclass my_temp_folder
mv my_temp_folder/myclass/.svn /path/to/my_project/myclass/

Again, this will work for some, but in the case above it may yet again not solve your issue.

3) Finally, you could copy the folder (in this case, myclass) to a temporary location, force delete it from svn's repository, and copy the folder back in, issue the add, and then commit again with the following commands:
cp -r myclass /home/myuser/myclass_temp/
svn --force delete myclass
cp -r /home/myuser/myclass_temp/ /path/to/my_project/myclass
svn add myclass
svn commit -m "Added myclass folder"

This 3rd step works for me everytime, though the others could work for you as well.


Since we're talking about SVN, here are some helpful commands should you need them...

Checkout a SVN Repository : svn co http://svn.mydomain.com/myrepo/my_project myproject

Force and ADD recursively to all files and directories inside a working SVN folder: svn add --force ./*

UPDATE a SVN project: svn update

Commit a change to your SVN project: svn commit -m "My Message here..."

Delete some files or folders from SVN svn --force delete my_file_or_folder

No comments:

Post a Comment