I read the subversion book and it is clear to me that subversion does not store individual files but only deltas in order to minimize disk space. Subversion also does the same with binary files as well (this used to be a huge weakness of CVS).
However I do not understand the exact mechanism. When I commit a file what happens?
- Subversion stores only the diff (and already has the old version)
- Subversion deletes the previous version, stores the new file intact and creates a reverse diff in order to "re-create" the old version if needed.
- Something else that I haven't thought of.
The first case might seem the most logical. This however raises another question. If I have in a subversion repository a file with 1000 commits and a new developer checks out a clean copy, then subversion would have to fetch the original version (initial import) and apply 1000 diffs on this before returning the result. Is this correct? Is there some sort of caching for files where the latest version is kept as well?
Basically where can I find information on the svn repository internals?
Update: Apparently the backend of subversion plays a big role in this. At the time
or writing FSFS uses option 1 while BDB uses option 2. Thanks msemack!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…