Using Subversion, where is “actual” source code stored?
I’m just getting used to Subversion and I have a fundamental question about versioning.
I’ve created my SVN repository on a server “S” hosted in my network. Assuming I “import” code, files, directories, etc. from another computer “A” in the network, it gets added to my server’s SVN repository.
I do a checkout from another computer “B” in the network and I can get all the code from the repository and so on.
Assuming I format or destroy PC “A”, would my source code still be available through a checkout in B?
If yes, when I actually browse into my repository folder on the server, I don’t find a replica of the folder, only the configuration, db, etc. directories. Where is the data physically stored on the server S, if it is there at all? Currently, the directory size of the repository is clearly much smaller than the source code folders.
I think VSS keeps a copy of the actual code in some unrecognizable db format, git has the option of not requiring to do this. Does SVN also maintain a copy of the code somewhere?
6 Solutions collect form web for “Using Subversion, where is “actual” source code stored?”
When you commit changes to your repository, they will be stored on server S inside your subversion repository. The repository is actually constructed of a series of deltas stored inside the
db/revs folder – changes from one version of the repository to the next. As such, the repository on the server will not resemble the structure of your source code. SVN repositories are versioned as a whole – any change within the repository increases the version of the repository.
You can recreate your source code by checking out a clean copy of the repository from the subversion server onto any machine.
The repository is physically stored in some data base on the SVN server. Once it’s imported into the repository no data will ever disappear except for defects on the server. Changes in working copies are irrelevant, unless they are committed – and even then everything ever committed can be found in the history. If you backup your the repository regularly, then nothing will ever completely disappear.
for svn the source code is stored as source code in any working directory and the source code + history are stored in the repository in a compressed form. so if you lost your repository you would lose any code that you dont currently have checked out. if you lose a checkout copy then only local changes are lost and anything else can be got from the repository.
for DVCSs the history is also stored in any checkout. so if your ‘main’ repository goes down (assuming you even have one) you should be able to get back all the history from peoples checked out versions.
and VSS is just broken.
Subversion stores files in some proprietary format (not sure off the top of my head) and not in a directory structure. As for it’s size, make sure you are actually committing the files. If you are simply adding them, the files are not put into the repository. Also, Subversion compresses what goes into the repository.
If all client computers are destroyed/formatted, as long as the server is still available you will have access to the files. If you lose the repository on the server though, you will be hosed unless you can salvage one of the checkouts to create a new repository. You will lose any history from this though, obviously.
Long story short, make sure to make periodic backups of the servers repository.
Once you import your source files, it’ll be stored inside SVN repository on the server. So if the PC “A” is destroyed, you will still be able to retrieve the sources from SVN.
The ‘db’ folder of the repository is where the actual files are.
You can read more about SVN repository structure here.
In addition to the other answers:
The working copy on PC B will not update itself automatically.
The repository directory should not be smaller than a full checkout. Make sure – by browsing the repository itself – that all files from your working copy are actually contained in the repository.