tags:

views:

493

answers:

3

A long time ago I had the following directory structure in my SVN repository

trunk/
    data/
        levels/
            1.level
            2.level
            ...
        ...
    ...

But I deleted the 'levels' directory long ago. Now I want to add a single text file called 'levels' to the 'data' directory, so it will look like this:

trunk/
    data/
        levels
        ...
    ...

Now when I try to add the file 'levels', I get this message:

$ svn add data/levels
svn: Can't replace 'data/levels' with a node of a differing type; the deletion m
ust be committed and the parent updated before adding 'data/levels'

How can I solve this?

+4  A: 

Try running svn update. That will update the current folder's revision number and all associated metadata. You should also make sure svn status doesn't display anything related to this.

Kevin Ballard
Looks like that fixed it, although I'm still not sure why. Thanks!
yjerem
A: 

As the error message indicates:

  1. first commit the deletion of the levels folder (svn ci)
  2. run an update (svn up)
  3. add the levels file (svn add data/levels)
  4. commit the levels file (svn ci)
Stefan
There was no levels folder, that's what confused me... I had already deleted it many revisions ago.
yjerem
If the levels folder doesn't show up if you run 'svn list url/to/trunk', then an 'svn up' should get your working copy to the current state again and adding the file should work.
Stefan
+1  A: 

It's usually good practice to run svn update before and after a commit so that your working copy is up-to-date.

Remember that whenever you make a commit in svn, it doesn't update your working copy. So, when you commit revision 10, your working copy is still revision 9 (or something lower).

sirlancelot