Looking for directories out of place in your SVN working copy?
The annoyance I sometimes run into with SVN is a working copy that gets corrupted by one of the .svn folders that are moved from their original location. This doesn't happen often if you're careful and use the proper tools for all moves and renames, but it still somehow happens from time to time.
First, does anyone know if there is a good way to catch the problem before committing? Cruise control usually catches the problem, but there are many cases it doesn't.
Secondly, is there a quick and easy way to check the .svn missing location folder if I suspect it is there? I can definitely do this by hand, inferring which directory is misplaced based on compiler errors, or by modifying the working copy with a different clean check. But that looks like a problem that SVN can diagnose in a second by giving me a list of all directories whose parent directory in the working copy does not match its parent directory in the repository. Is there some SVN way to give me such a list?
Thanks.
a source to share
The team svn status
can help with this.
For example, suppose I have a directory foo
and in the repository it has subdirectories bar
and baz
. And suppose I move baz
in bar
without reporting SVN. Then I get:
$ svn status foo/
? foo/bar/baz
! foo/baz
?
for foo/bar/baz
indicates that it exists in the local version, but not in the repository, more precisely, it exists in a directory foo/bar
on your local copy, but the SVN information foo/bar/.svn
has no record of this. Likewise, !
for foo/baz
indicates that it exists in the repository (or, more precisely, in the information in foo/.svn
), but the actual file / directory is not present in your local copy.
Meanwhile, if the problem is just some folder .svn
that is missing, it will look like this:
$ svn status foo/ ~ foo/quux
This means that it foo/.svn
says that it should exist foo/quux
, and foo/quux
exists, but does not foo/quux/.svn
.
Finally, if the problem is that there is a directory in the directory .svn
pointing to somewhere else other than its parent's subdirectory - say you did svn switch
in that directory - then you get this:
$ svn status foo/
S foo/quuux
If you are on Windows and use TortoiseSVN, you can get the same information by right clicking in the top level directory and choosing "TortoiseSVN → Check for Modifications" from the popup menu. Items that have been switched (ie Invalid directory .svn
) will show as "normal (s)" in their status.
a source to share