Tuesday, March 23, 2010

Subversion reported an error: 'path' is already a working copy for a different URL

If you want to create a new directory in a subversion server, but the local copy has already been linked to another directory/server you will get this error. Most of the fix for this on the internet will point to use svn commands. This might not be the case, since your old remote directory/server might not be available, and you might be using a client like Ankh where command line implementation is limited.

Ankh will spread a hidden .svn directory in every directory that has been linked with the old remote server/directory. Ankh also creates a ankh.load file in the project root.

The solution is to remove all this .svn directories and ankh.load file. This will make sure your local code will loose link with the old inexistent repository. You can do this by creating a .bat file with the following single line:
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"
The usage is simple:
deletesvn.bat "c:\projects\project1"
(if deletesvn.bat was the name you gave to your batch file and c:\projects\project1 is the root of the directories linked with the old repository)

TIP: Make sure your batch file deleted all .svn directories and you manually deleted the ankh.load file before trying to create a new directory on the new repository.

No comments:

Post a Comment