14

I had a folder that was part of one project in svn, that has been moved to a different folder / repository to be shared between projects. i want to replace this directory in svn w/ a symlink, but when I try to do so, I get this message:

svn: Entry '/project/wwwdocs/js' has unexpectedly changed special status

how can I replace this directory with a symlink?

4 Answers 4

18

The following sets the special property on every symlink and deletes it on normal files/directories. There are various ways to the determine the files to operate on.

svn_special_files=`svn propget --recursive svn:special | cut -d' ' -f1`
for i in `find . | grep -v "\.svn" | cut -d'/' -f2-`; do
  is_special=false
  for j in $svn_special_files; do 
    if [ "$j" = "$i" ]; then 
      is_special=true; 
      break; 
    fi
  done
  if [ -h $i ] ; then
    ! $is_special && svn propset svn:special '*' $i
  else
    $is_special && svn propdel svn:special $i
  fi
done
3
  • Very useful routine, and I never knew you use use ! like that. (+1) Oct 23, 2013 at 2:42
  • Explanation of the script: By setting the svn:special property correctly, you can commit the change from file to symlink or from symlink to file in one go. The script automatically sets the correct svn:special property for all files in your repository.
    – phobic
    Aug 29, 2016 at 12:39
  • Not sure if this answer is only relevant to an older version of svn, but when I try to propset on the symlink I get this error: "svn: Expected '/path/to/symlink' to be a directory but found a file". And if I try to commit it I get "svn: Entry for '/path/to/symlink' has no URL". Any tips? (svn --version indicates 1.6.17)
    – dlo
    Apr 3, 2018 at 21:12
16

In order for subversion to pick up the changes and detect the symlink, you need to first remove the original file, commit the deletion, and then update your repository. After that you should be able to add a symlink without any issues.

EDIT: This question seems to have been asked before and received some decent feedback. Check it out: Commit symlink into subversion

2
  • What happens to the deleted file in previous versions in this case? It is removed there also?
    – wander95
    Sep 25, 2017 at 20:12
  • It's been a long time since I've used SVN, so I honestly have no idea. Oct 4, 2017 at 22:51
3

You can even try a simple answer of removing culprit file -

svn remove --force <file>

This is especially helpful for Windows users using SVN cli.

1

You could execute command blow to fix this problem.

svn propset svn:special on /project/wwwdocs/js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.