English 中文(简体)
Status "S" in Subversion
原标题:

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?

最佳回答

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.

问题回答

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)

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.

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).

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.

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

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.

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.

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.

"Item is switched."

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

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

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

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>





相关问题
Best practices for Subversion and Visual Studio projects

I ve recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that s built from a cobbling-together ...

Changing username in SVN+SSH URI on the fly in working copy

I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer group and have full read/write permissions on the repository ...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

How to search for file in subversion server?

Is there a way to search for a file in a subversion repository? Something similar to Unix find command, with which I can find the location of a file in a repository. I know there is svn list, but ...

热门标签