基本概念

目录

版本库
版本模型
The Problem of File Sharing
锁定-修改-解锁 方案
拷贝-修改-合并 方案
Subversion实践
Subversion版本库URL
工作拷贝
修订版本
工作拷贝怎样跟踪版本库
混合修订版本的工作拷贝
总结

本章主要为那些不熟悉版本控制技术的入门者提供一个简单扼要的、非系统的介绍。我们将从版本控制的基本概念开始,随后阐述Subversion的独特理念,并演示一些使用Subversion的例子。

虽然我们在本章中以分享程序源代码作为例子,但是记住Subversion可以管理任何类型的文件集—它并非是程序员专用的。

版本库

Subversion是一个“集中式”的信息共享系统。版本库是Subversion的核心部分,是数据的中央仓库。版本库以典型的文件和目录结构形式文件系统树来保存信息。任意数量的客户端连接到Subversion版本库,读取、修改这些文件。客户端通过写数据将信息分享给其他人,通过读取数据获取别人共享的信息。图 1.1 “一个典型的客户/服务器系统”展示了这种系统:

图 1.1. 一个典型的客户/服务器系统


So why is this interesting? So far, this sounds like the definition of a typical file server. And indeed, the repository is a kind of file server, but it's not your usual breed. What makes the Subversion repository special is that it remembers every change ever written to it—every change to every file, and even changes to the directory tree itself, such as the addition, deletion, and rearrangement of files and directories.

When a client reads data from the repository, it normally sees only the latest version of the filesystem tree. But the client also has the ability to view previous states of the filesystem. For example, a client can ask historical questions such as “What did this directory contain last Wednesday?” or “Who was the last person to change this file, and what changes did he make?” These are the sorts of questions that are at the heart of any version control system: systems that are designed to track changes to data over time.