svn add "already under version control"

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


21 points

Is there any way to force subversion to ignore the fact that a locally modified folder has been entirely replaced by something else and just tell it to save the current working copy over the repository as a new version?

For example:

mkdir directory # the real directory has several files inside it too

svn add directory

svn ci

 rm -rf directory # another program removes this directory
 
 mkdir directory # it then creates an entirely new directory with similar files to the original directory
 
 
 svn add directory 
svn: warning: 'directory' is already under version control

Subversion will not let me use the new directory because it already knows about a previous one. The only solutions I've found from this list or from google is to remove the directory and re-run svn update, but this loses any changes from the new directory.

Any suggestions appreciated.



7 points

There are two ways:
1. Just check out, overwrite with the new dir and checkin. You will have to manually take care of added/removed files.
2. Use svn_load_dirs (mentioned in the book under 'tracking vendor sources' or somesuch). This tries to automatically take care of added/deleted/moved files when replacing a folder.

Anonymous's picture
Created by Anonymous
-3 points

It means a (invisible) folder .svn already exists with other svn data.Just (recursively) remove the .svn folder and it will work.

Anonymous's picture
Created by Anonymous
0 points

mv directory directory.new
svn up
svn remove directory
svn ci
mv directory.new directory
svn add directory
svn ci

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.