Subversion 如何在存储库中存储文件? [英] How exactly does subversion store files in the repository?

查看:59
本文介绍了Subversion 如何在存储库中存储文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了 subversion 的书,我很清楚 subversion 不存储单个文件,而只存储增量以最小化磁盘空间.Subversion 对二进制文件也做同样的事情(这曾经是 CVS 的一个巨大弱点).

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?

  1. Subversion 只存储差异(并且已经有旧版本)
  2. Subversion 会删除以前的版本,完整地存储新文件并创建反向差异,以便在需要时重新创建"旧版本.
  3. 还有一些我没有想到的东西.

第一种情况可能看起来最合乎逻辑.然而,这又引出了另一个问题.如果我在 subversion 存储库中有一个包含 1000 次提交的文件,并且新开​​发人员检查了一个干净的副本,那么 subversion 必须获取原始版本(初始导入)并在返回结果之前对其应用 1000 个差异.这样对吗?是否对还保留最新版本的文件进行某种缓存?

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?

基本上在哪里可以找到有关 svn 存储库内部结构的信息?

Basically where can I find information on the svn repository internals?

更新: 显然,subversion 的后端在这方面发挥了重要作用.当时或者写 FSFS 使用选项 1,而 BDB 使用选项 2.谢谢 msemack!

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!

推荐答案

因为 Subversion 的存储库格式完全是内部的,所以他们可以自由地将表示从一个修订版更改为下一个修订版.我相信当前版本通常存储反向增量(您的选项 2),但也会定期存储完整的快照,因此在返回结果之前不必解决 1000 个差异.

Because Subversion's repository format is entirely internal, they are free to change the representation from one revision to the next. I believe the current revision generally stores reverse deltas (your option 2), but also stores complete snapshots periodically so it doesn't have to resolve 1000 diffs before returning a result.

Subversion 1.6 发行说明中有一节介绍了文件系统存储改进 对此有一些说明,并链接到其他来源.可以说,Subversion 数据存储的细节很复杂,可能会发生变化.

The Subversion 1.6 release notes has a section on Filesystem storage improvements that has some notes on this, and links to other sources. Suffice to say that the details of Subversion data storage are complex and subject to change.

Subversion 源码树中还有一个设计文档,描述了 跳过 Subversion 中的增量.通常,/notes/ 目录包含一些关于 Subversion 内部的有用文档.

There is also a design document in the Subversion source tree that describes the use of skip deltas in Subversion. Generally, the /notes/ directory contains several useful documents regarding Subversion internals.

这篇关于Subversion 如何在存储库中存储文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆