116

I am getting a tilde symbol when I do an svn status.

Here is the output of the project after editing it in XCode.

svn status
M      build/Currency_Converter.build/Currency_Converter.pbxindex/imports.pbxbtree
M      build/Currency_Converter.build/Currency_Converter.pbxindex/pbxindex.header
M      build/Currency_Converter.build/Currency_Converter.pbxindex/symbols0.pbxsymbols
~      build/Currency_Converter.build/Currency_Converter.pbxindex/strings.pbxstrings
M      main.m
//more changed files

Any idea what that means? Can't seem to find it on google or any of the svn cheat sheets.

Interestingly, I only edited main.m, but there are lots of modified files. I don't know why that would be. Anyone have any tips for working with SVN and XCode? Should I only be putting my source files under version control?

Edit: Caused by a file that was already under version control being replaced by a file of another type. In this case, strings.pbxstrings used to be a file and now became a directory. Moral of the story is don't put your build folder into version control.

peterh
  • 11,875
  • 18
  • 85
  • 108
Jamison Dance
  • 19,896
  • 25
  • 97
  • 99
  • Hmm, I'm not sure if there's a way to "fix" it, as opposed to just re-adding. You may want to post another question asking if there's a good way to resolve this status, you'd get more attention (since the current question is already answered). – Chad Birch May 12 '09 at 16:05

11 Answers11

90

The SVN Book says:

Item is versioned as one kind of object (file, directory, link), but has been replaced by different kind of object.

So perhaps it was originally a single file, but you changed it to a directory, or something along those lines?

bahrep
  • 29,961
  • 12
  • 103
  • 150
Chad Birch
  • 73,098
  • 23
  • 151
  • 149
  • 1
    It looks like you are right. It is a directory now without a .svn file. Any idea on how to fix that? Do I need to delete it from subversion and add it again? – Jamison Dance May 12 '09 at 15:47
  • any chance you found a way to fix this? – Phill Pafford Sep 21 '10 at 18:28
  • @Phill - I ended up destroying the repository... *sigh* – Julian H. Lam Oct 13 '10 at 16:15
  • 49
    Best solution is to rename the new object (in your case, the directory); "svn remove" the object from the repository which is causing the collision (probably a file you've deleted), Commit, then rename the new object back and "svn add" it to the repository. Commit again. You'll have a sequence of 3 revisions where the old object existed, was removed, and the new object was added, respectively. – Brian Lacy Dec 06 '10 at 18:30
  • 9
    In case anyone reading this thread has the same problem: this happened to me and the reason for the '~' status was that I had some symbolic links in the repository, which had been overwritten by standard files by a 'sed -i' operation. I recreated the symbolic links and the '~' went away. – j b Jul 15 '11 at 13:13
  • Helped me save a very concerned designer today. – Aaron Jan 31 '12 at 22:01
  • Another cause of this is if you are programmatically deleting directory and re-creating it. In our case, a developer had checked in the `target` directory of a Maven project (with empty contents). When the project was cleaned and built, Maven deleted the directory and re-created it (now missing the `.svn` directory). In an `svn status`, the directory would show up with a `~`. The solution to this particular case is to `svn rm` the `target` directory and add it to the `svn:ignore` list of its parent. – Doug Paul Mar 01 '12 at 15:28
  • 5
    @JamieBullock Had the same thing happen to me for the same reason today. I tried this command before I even knew what the problem was: `svn status | grep ^~ | grep -o [^[:space:]]\*\$ | xargs svn revert` which was able to restore all the symlinks. – Paul Jul 12 '13 at 22:35
  • It happened to me after I deleted `.svn` directory from the directory (thinking I use Subversion 1.7, after that I got to know I have still 1.6). Removing that directory and then `svn up` did work for me. – maciek Sep 29 '15 at 08:46
  • The answer by @sancelot is much better; you have no need to rename if using `svn delete --keep-local fileName`. – DawnSong Apr 06 '16 at 10:55
34

Here's what i did:

If the folder is Test

  1. mv Test Test1
  2. svn remove Test
  3. mv Test1 Test
Tuong Le
  • 18,533
  • 11
  • 50
  • 44
  • 5
    This worked for me as long as I committed in between removing and adding. 1. mv Test Test1 2. svn remove Test 3. svn commit -m "Removed Test" 4. mv Test1 Test 5. svn add Test 6. svn commit -m "Added Test" – Brandon Brodjeski Nov 01 '12 at 22:38
  • 3
    The answer by @sancelot is much better; you have no need to rename if using `svn delete --keep-local fileName`. – DawnSong Apr 06 '16 at 10:54
15
svn delete --keep-local x
svn commit -m "del x"
svn add x
svn commit -m "blah"
sancelot
  • 1,905
  • 12
  • 31
15

From

svn help status

'~' versioned item obstructed by some item of a different kind

I have only seen this where the file permissions had changed and svn had no execute access on it I beleive.

Hope this helps.

12

The easiest way to fix this is to backup, then delete the folder or file that has this status and then do "svn up": it's not necessarily a folder relplaced by a file, it might be just that .svn folder is missing or corrupted.

deadprogrammer
  • 11,253
  • 24
  • 74
  • 85
10

This can happen when you remove the .svn folder in a folder (by example when you remove a directory, and then you create the same directory again), or when you replace a directory with a symbolic link, or a file with the same name.

Supposing it's a folder called a-folder, you can fix this by issuing the following commands in the parent folder:

$ find a-folder -type d -name '.svn' -print0 | xargs -0 rm -Rf
$ svn up --force .
svn: Directory 'logs/.svn' containing working copy admin area is missing
$ svn up --force .
E    a-folder
...
Updated to revision n.

And then it's matter of svn adding/removing and commiting the changes again

Jorge Muñoz
  • 641
  • 6
  • 12
3

I just want to share that this is an issue frequently encountered when installing extensions within Joomla. The extensions are installed through the CMS and are owned by apache with no group write. Generally the next step is to add the files to the SVN but if you don't sudo or change the file perms, then SVN fails when it can't write the .svn directory. Here's the easy solution.

mv foo foo-bak
svn up foo
svn revert foo

# just for good measure. Foo should not show up in the two following commands.
ls | grep foo
svn st | grep foo

mv foo-bak foo
svn add foo
Collin James
  • 9,062
  • 2
  • 28
  • 36
3

Had a similar issue, SVN was complaining about a lock. Here's what we did:

  • Backed up the files
  • Removed the directory in question with rm -r (linux)
  • Ran svn cleanup on the directory
  • Ran svn up --force on the directory
M.W. Felker
  • 4,777
  • 1
  • 20
  • 19
2

It may be also matter of symbolic links under Windows. When you commit symbolic link into SVN and then check it out under Windows, links are changed to regular files and this is also reported as ~.

zbyszanna
  • 21
  • 1
2

I often had this while upgrading modules under (eg.) Joomla!, Wordpress or Drupal. Sometimes the .svn directory get removed by the upgrading process.

# rename updated directory
mv foo foo.new

# restore the old directory
svn up foo

# merge / update the old directory with new items
# notice that the above command will preserve the obsolete files
# so you should do a diff -r in order to remove them
cp -r foo.new/* foo

# Add files commit, etc
svn add foo/*
svn delete foo/xx
svn commit -m "updated module"
0
~ versioned item obstructed by some item of a different kind
    Second column: Modifications of a file's or directory's properties
Nanhe Kumar
  • 15,498
  • 5
  • 79
  • 71