Monday, May 2, 2011

Deleting unwanted directories from Subversion

Here is the problem: I have svn-moved a whole bunch of files out from a directory tree that is being version-controlled by svn. E.g.

parent/dir_1/dir_A/file_1
parent/dir_1/dir_A/file_2
parent/dir_1/dir_B/file_3
parent/dir_1/dir_B/file_4
parent/dir_2/dir_A/file_5
parent/dir_2/dir_A/file_6
parent/dir_2/dir_B/file_7
parent/dir_2/dir_B/file_8

has become

parent/file_1
parent/file_2
parent/file_3
parent/file_4
parent/file_5
parent/file_6
parent/file_7
parent/file_8

Now I want to get rid of (remove from svn's version control and delete from the filesystem) the following directories

dir_1/
dir_1/dir_A/
dir_1/dir_B/
dir_2/
dir_2/dir_A/
dir_2/dir_B/

The way to do this so that you do not encounter conflict errors is like this:

user@computer>% cd parent
user@computer> svn delete dir_1
user@computer> svn delete dir_2
user@computer> svn update
user@computer> svn commit

If you try to skip the 'update' command, you will encounter conflict errors.