So - I used to have a directory called mysql a few revisions ago. I deleted it, and decided to start over - but when I try to create the new mysql directory - I keep running into the 'File Already Exists' error:
support:/etc/puppet/modules# mkdir mysql
support:/etc/puppet/modules# svn add mysql/
A mysql
support:/etc/puppet/modules# svn commit -m " Test"
Adding modules/mysql
svn: Commit failed (details follow):
svn: File already exists: filesystem '/var/lib/svn/puppet/db', transaction '11-r', path '/trunk/modules/mysql'
support:/etc/puppet/modules# svn delete mysql
svn: Use --force to override this restriction
svn: 'mysql' has local modifications
support:/etc/puppet/modules# svn --force delete mysql
D mysql
I saw some other posts suggest forcing an update
support:/etc/puppet/modules# svn status
support:/etc/puppet/modules# svn update
At revision 11.
support:/etc/puppet/modules# svn mkdir mysql
A mysql
support:/etc/puppet/modules# svn commit -m "Test"
Adding modules/mysql
svn: Commit failed (details follow):
svn: File already exists: filesystem '/var/lib/svn/puppet/db', transaction '11-s', path '/trunk/modules/mysql'
This question is related to
svn
This solution merges smoothly and does not lose history:
I'm not sure if this is helping you, but I guess that when you do a svn add mysql
after you've deleted it it will just reinstantiate the directory (so don't do a mkdir yourself). If you create a directory yourself svn expects a .svn directory inside it because it already 'knows' about it.
What you need is the svn 'export' command. With this you can put a file or entire directory tree in the state of another revision in another branch.
So something like
rm file #without 'svn' in front!
svn export myrepo/path/to/file@<revision> .
svn commit
I ran into this problem today when Xcode crashed during a branch merge. Somehow the file was uploaded to the svn repository but it wasn't recorded in the svn db properly. I ran the following commands in the directory where the file existed locally:
svn revert bad.file
svn del svn://my.svnserver.com/svnDB/path/to/the/offending/file/bad.file
Then I re-added the file from my local system:
svn add bad.file
svn commit -m "Re adding bad.file"
Success!
This is a nasty one... mysterious error and no clear fix.
update/revert/commit did NOT work in my situation. I hadn't done anything weird - just some svn moves.
What DID work for me was:
svn remove offender
svn commit
cd ..
rm -fR parent
svn up parent
cd parent
svn remove offender again
svn commit
copy offender back in (minus .svn dirs)
svn add
svn commit
Weird to say the least. Basically, the svn remove --force offender
wasn't doing completely removing for some reason. Which is sort of what the error message was saying. Only by removing the parent, then updating the parent, did this become obvious because then the offender reappeared! svn removing offender again then properly removed it.
This situation occured if there are object in repository, which creates by current transaction.
Simple scenario:
Same thing when adding same files from two working copies.
As per Atmocreation's solution, except you don't need to re-checkout the whole project, which is useful if you have existing work in progress.
Let's say you have a working copy:
/foo/
which contains directories:
/foo/bar/baz
and you're getting the error message on commit:
svn: File already exists: filesystem '/foo/bar'
Backup the contents of bar somewhere:
mkdir -p ~/tmp/code_backup
cp -r /foo/bar ~/tmp/code_backup
Delete the .svn control directories from the backup. Make sure you get this command right, or you can do pretty serious damage!! Delete them manually if you're unsure.
find ~/tmp/code_backup/bar -name .svn -type d -exec rm -rf {} \;
Double check that the copy is identical:
diff -r -x .svn dist ~/tmp/code_backup/dist
Remove the offending directory from the working copy: cd /foo rm -rf bar
And then restore it from the repository:
cd /foo
svn update bar
Copy back the modified files from backup:
cp -r ~/tmp/code_backup/bar /foo/
You should now be able to commit without the error.
I had a problem like this when I deleted a folder (and sub-folders) and went to recreate them from scratch. You get this error from manually deleting and re-adding folders (whereas files seem to cope OK with this).
After some frustrating messing around, found I had to:
(using TortoiseSVN on Windows)
svn update
which added old files/folders back into working copysvn delete
foldercommit
commit
Unfortunately it (A) requires two commits, and (B) loses file revision history as it only tracks back to the recent re-add (unless someone can explain how to fix this). An alternative solution that works around these 2 issues is to skip steps 3 and 4, the only problem being that old/unnecessary files may still be present in your directory. You could delete these manually.
Would love to hear any additional insights others might have on this.
Simon.
[Update] OK, I had this same problem again just then, but the offending folder was NOT in the last commit, so an update
didn't restore it. Instead I had to browse the repository and delete
the offending folder. I could then add
the folder back in and commit
successfully.
already had this type of problem.
my solution was:
delete the folder from svn but keep a copy of the folder somewhere, commit the changes. in the backup-copy, delete recursively all the .svn-folders in it. for this you might run
#!/bin/bash
find -name '.svn' | while read directory;
do
echo $directory;
rm -rf "$directory";
done;
delete the local repository and re-check out entire project. don't know whether partial deletion/checkout are sufficient.
regards
I had this problem on a project I run on Netbeans. I simply right clicked on the file and update to fix it (after SVN up).
Had similar problem. To resolve it, updated from svn trunk with option of priority of local files.
svn update path/ --accept=mine-full
After You could commit as usual. Of course, be careful using it.
The problem is that the checkout takes place on a laptop and in this case subversion can not cope with the off-line synchronization. The problem is reproducable on an other laptop while on a desktop I have no problem checking out the same repository.
I hope this answer wil help you, it took me quite long to find out.
Source: Stackoverflow.com