views:

62

answers:

2

I am immensely troubled and disturbed by the fact that subversion is creating random .svn folders in my local repo. I am used to Perforce which does not do this. Is there any way to prevent subversion from doing this? Will it affect svn if I delete the folders or use some sort of script to delete them?

+10  A: 

The .svn directories are what store the repository history and metadata. Every revision control system must store auxiliary information (at the very least, past versions of the files!). Don't delete them unless you want to bring the repository down to a simple working set, with no more ability to commit changes or update with new revisions.

I find it amusing that you are 'immensely troubled and disturbed' by the creation of these hidden folders which implement all the nice features you want from a version control system.

CVS has such a directory. Mercurial has a directory at the top of the repository. Perforce is different because it is backed by a database; it stores all metadata outside the repository it concerns. This means that, in Perforce, if you just copy a repository's contents, you can't manipulate it any more on the other side without hooking back into the database. This is your db.rev, db.changes, and db.have files, by the way. You might have been immensely troubled and disturbed by them before.

I have any easy solution to your troubles with the .svn directories: ignore them.

Borealid
may be he is on windows where .files are not hidden
Amarghosh
@Amarghosh: he can mark them hidden, if they're not already.
Borealid
they "should" be hidden by default - though he would have to turn off the ability to "view hidden files and folders" in the view settings.
rockinthesixstring
So I guess a follow up question to this is that if my working folder is different from my local svn folder (for any bizarre reason) and if I copy over the contents of my working folder to my local svn folder for a checkin, then I have effectively overwritten the svn metadata and corrupted the repository? I'm trying to think why the metadata for revisions has to be stored locally instead of on the remote repo?
arunabhdas
Oh and yes, I am on Win-doze and also using Tortoise SVN (very not-nerdy, I know).
arunabhdas
@arunabhadas: The working directory and the repository are distinct. You don't just copy files from one to the other; you use 'commit' to copy files into the repository and 'checkout' or 'update' to copy files out. You don't ever manually move things between the two.SVN doesn't actually store the entire repository history locally. Mercurial, GIT, DarCS, and other DVCSen (the D is for 'Distributed') do. SVN stores other metadata. Don't worry about it.
Borealid
Oh sorry. I think I mis-spoke. So I have a remote repo (on another server). And then I have a MySVN folder. And then I have a MyProjects folder. I guess my question is. Now, typically, I do adds+commits from MySVN folder. But what if, at some point, I had to copy over my source from MyProjects folder to MySVN folder. Since that would overwrite the .svn folders, I am guessing my revision history would be lost?
arunabhdas
P.S: I keep MyProjects mirrored with the MySVN folder as a backup.
arunabhdas
The point is that the .svn folders go with the files which they concern. So if you copy the files, you also copy their metadata. There is no problem.
Borealid
Thanks Borealid!!
arunabhdas
+4  A: 

I am immensely troubled and disturbed by the fact that subversion is creating random .svn folders in my local repo.

Don't be troubled, they're there for a reason. Every directory in your project gets it's own .svn folder that stores all subversion meta data

Is there any way to prevent subversion from doing this?

Not if you want to continue using subversion the way it is meant to be used

Will it affect svn if I delete the folders or use some sort of script to delete them?

Yes, all of your versioning will be shot and you will have to rebuild your SVN.

rockinthesixstring