How does VCS such as SVN store files?
As I am learning Git, I get to know that the other VCS systems like SVN usually store changes to a base version of files. So, as a logical deduction, if I want to check out the version 4 of the file A, the SVN will patch the base version file on-the-fly with all the change sets commited until version 4 before delivering the verion I want?
The following pi开发者_如何学Ccture may be helpful.
In short, only the base version file is stored statically, all the other versions are dynamically generated with base file and necessary change sets.
right?
Thanks.
From Subversion Design doc:
Like many other revision control systems, Subversion stores changes as differences. It doesn't make complete copies of nodes; instead, it stores the latest revision as a full text, and previous revisions as a succession of reverse diffs (the word "diff" is used loosely here – for files, it means vdeltas, for directories, it means a format that expresses changes to directories).
Important point is that, the latest revision is the base and (reverse) diffs are stored from that backwards.
http://svn.apache.org/repos/asf/subversion/trunk/notes/subversion-design.html#server.fs.struct
You can also look at the link to see how the commit gets stored in the repository.
There is a lot of documentation about how Subversion stores its files, but the truth is that you really shouldn't know. Otherwise, you might be tempted to make these changes behind the repository manager's back.
The structure of the repository backend is a hot issue. Some groups say that this should be well documented and well understood in case there are problems, and the user can fix them. Others say that the structure should never be touched, and that the biggest issues usually arise from end users who think they know what they're doing, muck up the repository, and destroy everything.
Subversion repositories actually have two formats. One uses the FSFS file format (what most people use now), but originally, Subversion used Berkeley DB (BDB) for storing files. (It still can, but you now must specify it). In the future, Subversion will probably switch to SQLite or MySQL as its repository backend.
This will allow the Subversion developers to separate out the execution code from the repository structure. This will make adding new features much, much easier to do. For example, there has been a lot of hue and cry for an obliterate command. Unfortunately, from what Subversion developers have told me, it's simply impossible to do within the current FSFS file structure. A SQL based repository would have made this much easier.
First you can't checkout a single file in Subversion. The smallest part you can checkout is a directory, but that will not change anything.
The best documentation about how SVN works and how things are stored can be read here.
精彩评论