Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange problem with Subversion - "File already exists" when trying to recreate a directory that USED to be in my repository

Tags:

svn

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'
like image 267
gnarf Avatar asked Sep 10 '09 22:09

gnarf


4 Answers

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)

  1. Move conflicting folders out of working copy (so that I don't lose my work-in-progress)
  2. Do an svn update which added old files/folders back into working copy
  3. svn delete folder
  4. commit
  5. Copy new folder back into working copy (ensuring you delete all the .svn folders inside)
  6. 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.

like image 164
Simon East Avatar answered Oct 22 '22 07:10

Simon East


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.

like image 35
Fedir RYKHTIK Avatar answered Oct 22 '22 09:10

Fedir RYKHTIK


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

like image 12
Atmocreations Avatar answered Oct 22 '22 08:10

Atmocreations


I managed to work around it by reverting back to the last version that I had the mysql directory in, then deleting the contents of the directory, putting the new contents in it, and checking the new information back in. Although I'm curious if anyone has a better explanation for what the heck was going on there.

like image 11
gnarf Avatar answered Oct 22 '22 08:10

gnarf