Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 527
Kaushik Gopal Avatar asked Nov 19 '09 13:11

Kaushik Gopal


People also ask

Where is SVN data stored?

Your svn repository is stored in a folder in the filesystem, it should contain sub-folders like: conf, dav, db, hooks, locks . These folders make up the repository. There's an svnadmin tool you can use to manage the repository.

What is SVN source code repository?

SVN is a Subversion control tool that helps us to maintain all the project artifacts in a script repository. It's a free/open-source tool that helps us to manage software versioning and revision control system. It is easy to understand and works faster when compared to the other tools (For Example, GIT, mercurial).


5 Answers

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.

like image 81
adrianbanks Avatar answered Oct 01 '22 21:10

adrianbanks


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.

like image 28
sbi Avatar answered Oct 01 '22 20:10

sbi


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.

like image 31
jk. Avatar answered Oct 01 '22 22:10

jk.


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.

like image 22
stask Avatar answered Oct 01 '22 22:10

stask


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.

like image 29
jamesmillerio Avatar answered Oct 01 '22 20:10

jamesmillerio