81

At some point all files in my working copy got marked with "S" symbol as shown below:

$ svn st
M    S   AclController.php
     S   InstallationController.php
     S   CustomerController.php
     S   RedirController.php
     S   IndexController.php
     S   LoginController.php
     S   OrderController.php
     S   ProductController.php
     S   SelfInstallController.php
     S   SelfcareController.php

Interestingly it occurs only int this particular working copy - when I checkout the project to new directory, it does not show the "S" marks.

How to get rid of this annoying "S" symbols? It significantly decreases clarity of WC status.

Update: I do switch from time to time using standard svn switch syntax. It was never causing this "S" symbol to appear until recently. The command used to switch was:

svn switch svn+ssh://xxxxxx/subversion/xxxxxxx/releases/1.0.16 .

Is there any way I can clear the "S" flag?

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
Michał Niedźwiedzki
  • 12,859
  • 7
  • 45
  • 47
  • 8
    Status S means "switched", according to `svn h st`. What **that** means, however… – me_and Dec 08 '09 at 12:00
  • 1
    @me_and: Switching working copies: http://svnbook.red-bean.com/en/1.0/ch04s05.html – Chris J Dec 08 '09 at 12:04
  • 1
    Just for the record -since it's the closest problem I've found online-, we were having a the S flag issue while trying to merge a branch into trunk. It had to do with the fact that we were using externals. They were removed on the branch but trunk kept referencing them, thus failing to merge. The solution was to remove the externals that we removed on the branch in trunk, commit trunk and reintegrate again. Hope that helps someone along the way :) Cheers! – Darío Javier Cravero May 10 '12 at 15:43

14 Answers14

80

It means that the files are from a different location in your subversion repository than the directory containing them. The solution is to switch the entire working copy to the same location. See the two sections in the subversion book for details on how to invoke the command.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95
  • 36
    I've seen this happen also when an "svn switch" command is interrupted by a conflict of some sort, such as the branch you're switching to having a repository version of a local file which isn't committed. Hopping out of svn to fix that leaves the overall working copy incompletely switched over. Resolving the issue and then re-executing the switch command works for me. – Michael H. Aug 09 '11 at 16:47
  • 4
    I had this following an error - E210002: Network connection closed unexpectedly. Re-executing the switch command seemed to fix the problem and the "S" status was gone. – Kevin Sadler Apr 22 '15 at 19:42
  • 1
    Interruption during svn switch IS causing this. Be aware. – sanya Aug 12 '15 at 16:22
  • 3
    Kevin Sadler actually provides the solution, not just describes the problem. +1 – ahnbizcad Apr 12 '16 at 22:33
  • 1
    Like @KevinSadler said, if you tried to switch from branch1 to branch2 and aborted the merge conflicts then this issue occurs. Solution is to branch2 and then switch back to branch1 `svn switch ` followed by `svn switch ` solves this issue. – ryk Aug 04 '21 at 17:03
12

If you call 'svn info' on the directory itself and on (one of) the files inside you will get two different URLs.

You get the 'S' status if the url of a file/directory does not match the URL of the parent followed by the name of the file.

Can you post the url of the parent and one of the child nodes? (anonymizing the URL where appropriate)

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
9

I had 'S' status while switching from trunk (r100) to some branch (r50). I got the error :

svn: Failed to add file 'web/.htaccess': an unversioned file of the same name already exists

All web/'s subdirs were 'S' flagged.

The cause : i had deleted .htaccess to svn:ignore it (r100), then had created it again (unversioned and ignored). The branch (r50) still had web/.htaccess in the repo.

The solution :

mv web/.htaccess ../../
svn switch back to trunk
svn switch to branch again

Everything's fine.

sglessard
  • 3,097
  • 2
  • 27
  • 31
  • I had a similar error, but I deleted my offending version of "web/.htaccess" (because for me it was several directories) and did svn update, then switched from trunk to a specific tag back to trunk (the specific tag was actually a copy of trunk...) and the erroeneous 'S' flags went away. – Kasapo Jan 20 '12 at 17:11
6

I had this problem with a directory I successfully committed to SVN. The solution for me was to erase it locally then update. I couldn't see any differences, but the .svn file was fixed for whatever reason (no more S).

Eli
  • 4,874
  • 6
  • 41
  • 50
  • I had this happen in an svn external after updating to a newer branch. Deleting the entire external manually then running svn update fixed it. +1! – Stephen Fuhry Apr 09 '11 at 01:33
5

In case anyone is coming in late looking for the answer (which is stated correctly above), I believe a likely CAUSE of this situation is an 'svn switch' on a parent directory that fails (as in the case of a local uncommitted file with the same name, and no --force option), leaving all files subsequent to the failure 'un-switched'.

That is why (assuming the original issue is later corrected) a subsequent 'svn switch' again on the same parent directory will indeed switch the remaining un-switched files to a new repo path.

John Kennedy
  • 51
  • 1
  • 1
5

This is usually caused by an interruption when switching branches.

Switch to a different branch, and then switch back to the branch you really want.

svn switch some_other_branch_url

svn switch desired_branch_url

ahnbizcad
  • 10,491
  • 9
  • 59
  • 85
4

Just a remark: I got the same S symbol when I checked out a deleted directory from the same location in the repository but using a different URL, i.e., using distinct protocols to checkout like 'svn checkout svn+ssh://user@scm.gforge...' against 'svn checkout --username user https://scm.gforge....'. I solved it by checking it out again by using the same URL that I used for the first checkout.

3

There's another way in which this status can be achieved - which hopefully will save someone some time tracking it down.

I unpacked an external library into my SVN root, and it turns out the third-party author has accidentally included their own .svn folder in one of their folders. This of course overwrites our own, correct, subversion folder, and has the same effect as described elsewhere on this page - a folder appears to have switched unexpectedly to another branch.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Yes, I just had this. I had copied a directory of icons from one project to another without deleting the `.svn` directories. Either export a clean directory to use, or go through and delete the .svn directories after copying, and it will `svn add` predictably. – Eric Jun 04 '15 at 20:32
3

This means that you've switched from one working copy to another, for example you've checked out a working copy, then swapped it over to be comparing against a code branch. Take a look at the SVN book for details on how to undo this.

me_and
  • 15,158
  • 7
  • 59
  • 96
1

"Item is switched."

If you used "svn switch" on your working copy that might explain it?

stiank81
  • 25,418
  • 43
  • 131
  • 202
  • I've been trying to use the switch command now, but I don't ever get the 'S" in status.. Did you switch? And did you do it in some none-mainstream way? – stiank81 Dec 08 '09 at 12:28
1

A simple solution to get rid of the 'S' when you issue

svn status

is to just go to the dir that is marked with 'S' and delete the hidden .svn directory:

rm -rf .svn

Afterwards the sources show up marked with '?' and you could easily add them freshly:

svn add path/to/resource

Torsten Barthel
  • 3,059
  • 1
  • 26
  • 22
  • In my case the 'S' showed up next to resources that I added from another repo on the same server so the solution I just described above was obvious. – Torsten Barthel Jan 30 '18 at 00:34
0

For me this happens when "svn switch" command is interrupted and to solve it with TortoriseSVN, I right click on the file and select switch back to parent

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
0

In my case two sub-directories in the branch were deleted in the trunk. I switched from trunk the branch from the top level directory, and then moved back to trunk and experience the problem with those sub-directories are now in status S.

I used the answer by @ahnbizcad as a guideline. From the parent directory (which is itself under the top level directory) of the sub-directories:

svn sw <branch_url>

svn sw <trunk_url>

Soumya Kanti
  • 1,429
  • 1
  • 17
  • 28
-6

I suggest you read its official help, try:

svn st --help

or

svn st --help | grep S

'S' the item has a Switched URL relative to the parent
Siwei
  • 19,858
  • 7
  • 75
  • 95