As we mentioned earlier, each directory of a Subversion
working copy contains a special subdirectory called
.svn
that houses administrative data about
that working copy directory. Subversion uses the information in
.svn
to keep track of things like:
工作拷贝中展示的目录和文件在版本库中的位置。
工作拷贝中当前展示的文件和目录的修订版本。
所有附加在文件和目录上的用户定义属性。
Pristine (unedited) copies of the working copy files.
Subversion工作拷贝管理区域的布局和内容主要是考虑的实现细节,不是被人来使用的。开发者被鼓励使用Subversion的API或工具来访问和处理工作拷贝数据,反对直接读写操作组成工作拷贝管理区域的文件。工作拷贝中管理数据采用的文件格式会不断改变—只是公共API成功的隐藏了这种改变。在本小节,我们将会探讨一些实现细节来安抚你们的焦虑。
Perhaps the single most important file in the
.svn
directory is the
entries
file. It
contains the bulk of the administrative
information about the versioned items in a working copy
directory. It is this one file that tracks the repository
URLs, pristine revision, file checksums, pristine text and
property timestamps, scheduling and conflict state
information, last-known commit information (author, revision,
timestamp), local copy history—practically everything
that a Subversion client is interested in knowing about a
versioned (or to-be-versioned) resource!
熟悉CVS管理目录的人可能会发现,Subversion的.svn/entries
实现了CVS的CVS/Entries
、CVS/Root
和CVS/Repository
的功能。
The format of the .svn/entries
file
has changed over time. Originally an XML file, it now uses a
custom—though still human-readable—file format.
While XML was a great choice for early developers of
Subversion who were frequently debugging the file's contents
(and Subversion's behavior in light of them), the need for
easy developer debugging has diminished as Subversion has
matured and has been replaced by the user's need for snappier
performance. Be aware that Subversion's working copy library
automatically upgrades working copies from one format to
another—it reads the old formats and writes the
new—which saves you the hassle of checking out a new
working copy, but can also complicate situations where
different versions of Subversion might be trying to use the
same working copy.
如我们前面提到的,.svn
也包含了一些原始的“text-base”文件版本,可以在.svn/text-base
看到。这些原始文件的好处是多方面的—察看本地修改和区别不需要经过网络访问,减少传递修改时的数据—但是随之而来的代价是每个版本化的文件都在磁盘至少保存两次,现在看来这是对大多数文件可以忽略不计的一个惩罚。但是,当你版本控制的文件增多之后形势会变得很严峻,我们已经注意到了应该可以选择使用“text-base”,但是具有讽刺意味的是,当版本化文件增大时,“text-base”文件的存在会更加重要—谁会希望在提交一个小修改时在网络上传递一个大文件?
Similar in purpose to the “text-base” files
are the property files and their pristine
“prop-base” copies, located in
.svn/props
and
.svn/prop-base
respectively. Since
directories can have properties too, there are also
.svn/dir-props
and
.svn/dir-prop-base
files.