This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit http://www.svnbook.com/ for stable versions of this book.

Kiểm Soát Phiên Bản với Subversion [DRAFT]

Dành cho phiên bản Subversion 1.8

(Được biên dịch từ r6065)

Ben Collins-Sussman

Brian W. Fitzpatrick

C. Michael Pilato

Tác phẩm này được cấp phép theo Giấy phép Ghi công Creative Commons. Để xem bản sao của giấy phép này, truy cập http://creativecommons.org/licenses/by/2.0/ hoặc gửi thư đến Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.


Table of Contents

Lời Tựa
Lời Nói Đầu
Subversion Là Gì?
Subversion có phải là công cụ phù hợp?
Lịch sử Subversion
Kiến trúc Subversion
Thành phần Subversion
Có gì mới trong Subversion
Độc Giả
Đối Tượng Nên Đọc Cuốn Sách Này
Trình Bày Của Cuốn Sách
Đây Là Cuốn Sách Miễn Phí
Lời Cảm Ơn
I. Nhận Biết Subversion
1. Những Khái Niệm Cơ Bản
Căn Bản Kiểm Soát Phiên Bản
Kho lưu trữ
Bản sao làm việc
Mô hình phiên bản
Vấn đề của việc chia sẽ tập tin
Giải pháp khoá-sửa đổi-mở khoá
Giải pháp sao chép-sửa đổi-hợp nhất
Kiểm Soát Phiên Bản Theo Cách Của Subversion
Kho lưu trữ Subversion
Phiên bản
Địa chỉ kho lưu trữ
Bản sao làm việc Subversion
Bản sao làm việc hoạt động như thế nào
Tương tác cơ bản trên bảo sao làm việc
Bản sao làm việc phiên-bản-hỗn-hợp
Tóm Tắt
2. Cách Sử Dụng Cơ Bản
Trợ Giúp!
Đưa Dữ Liệu Vào Trong Kho Lưu Trữ Của Bạn
Nhập tập tin và thư mục
Khuyến nghị cách bố trí kho lưu trữ
Tên gọi nói lên điều gì?
Tạo Bản Sao Làm Việc
Chu Kỳ Làm Việc Cơ Bản
Cập nhật bản sao làm việc của bạn
Thực hiện thay đổi của bạn
Xem lại thay đổi của bạn
Xem tổng quan về những thay đổi của bạn
Kiểm tra chi tiết những thay đổi trên bản sao cục bộ của bạn
Sửa lỗi của bạn
Giải quyết xung đột
Xem những khác biệt trên xung đột một cách tương tác
Giải quyết xung đột một cách tương tác
Hoãn giải quyết xung đột
Giải quyết xung đột theo cách thủ công
Huỷ bỏ những thay đổi của bạn và sử dụng phiên bản mới được lấy về
Đánh cược: sử dụng svn revert
Chuyển giao những thay đổi của bạn
Xem Xét Lịch Sử
Xem chi tiết những thay đổi trong lịch sử
Xem xét những thay đổi cục bộ
So sánh bản sao làm việc với kho lưu trữ
So sánh những phiên bản trên kho lưu trữ
Tạo một danh sách các thay đổi lịch sử
Duyệt kho lưu trữ
Hiển thị nội dung tập tin
Hiển thị thuộc tính thay đổi theo-từng-dòng
Liệt kê danh sách những thư mục được định phiên bản
Lấy lại những phiên bản cũ trên kho lưu trữ
Đôi Khi Bạn Chỉ Cần Dọn Dẹp
Hủy bỏ bản sao làm việc
Phục hồi từ gián đoạn
Xử Lý Xung Đột Về Cấu Trúc
Một ví dụ xung đột cấu trúc cây
Tóm Lược
3. Advanced Topics
Revision Specifiers
Revision Keywords
Revision Dates
Peg and Operative Revisions
Properties
Why Properties?
Manipulating Properties
Properties and the Subversion Workflow
Inherited Properties
Automatic Property Setting
Subversion's Reserved Properties
Versioned properties
Unversioned properties
File Portability
File Content Type
File Executability
End-of-Line Character Sequences
Ignoring Unversioned Items
Keyword Substitution
Sparse Directories
Locking
Creating Locks
Discovering Locks
Breaking and Stealing Locks
Lock Communication
Externals Definitions
Changelists
Creating and Modifying Changelists
Changelists As Operation Filters
Changelist Limitations
Network Model
Requests and Responses
Client Credentials
Caching credentials
Disabling password caching
Removing cached credentials
Command-line authentication
Authentication wrap-up
Working Without a Working Copy
Remote command-line client operations
Using svnmucc
Summary
4. Branching and Merging
What's a Branch?
Using Branches
Creating a Branch
Working with Your Branch
The Key Concepts Behind Branching
Basic Merging
Changesets
Keeping a Branch in Sync
Subtree Merges and Subtree Mergeinfo
Reintegrating a Branch
Mergeinfo and Previews
Undoing Changes
Resurrecting Deleted Items
Advanced Merging
Cherrypicking
Merge Syntax: Full Disclosure
Merges Without Mergeinfo
More on Merge Conflicts
Blocking Changes
Merge-Sensitive Logs and Annotations
Noticing or Ignoring Ancestry
Merges and Moves
Preventing Naïve Clients from Committing Merges
The Final Word on Merge Tracking
Traversing Branches
Tags
Creating a Simple Tag
Creating a Complex Tag
Branch Maintenance
Repository Layout
Data Lifetimes
Common Branching Patterns
Release Branches
Feature Branches
Vendor Branches
General Vendor Branch Management Procedure
Vendor Branches from Foreign Repositories
Vendor Branches from Mirrored Sources
To Branch or Not to Branch?
Summary
5. Repository Administration
The Subversion Repository, Defined
Strategies for Repository Deployment
Planning Your Repository Organization
Deciding Where and How to Host Your Repository
Controlling Access to Your Repository
Creating and Configuring Your Repository
Creating the Repository
Implementing Repository Hooks
Hook script environment configuration
Common uses for hook scripts
Finding hook scripts or rolling your own
FSFS Configuration
Repository Maintenance
An Administrator's Toolkit
svnadmin
svnlook
svndumpfilter
svnrdump
svnsync
fsfs-reshard.py
Commit Log Message Correction
Managing Disk Space
How Subversion saves disk space
Removing dead transactions
Packing FSFS filesystems
Migrating Repository Data Elsewhere
Repository data migration using svnadmin
Repository data migration using svnrdump
Filtering Repository History
Repository Replication
Replication with svnsync
Partial replication with svnsync
A quick trick for mirror creation
Replication wrap-up
Repository Backup
Managing Repository UUIDs
Moving and Removing Repositories
Summary
6. Server Configuration
Overview
Choosing a Server Configuration
The svnserve Server
svnserve over SSH
The Apache HTTP Server
Recommendations
svnserve, a Custom Server
Invoking the Server
svnserve as daemon
svnserve via inetd
svnserve via xinetd
svnserve over a tunnel
svnserve as a Windows service
svnserve as a launchd job
Built-in Authentication and Authorization
Create a users file and realm
Set access controls
Using svnserve with SASL
Authenticating with SASL
SASL encryption
Tunneling over SSH
SSH Configuration Tricks
Initial setup
Controlling the invoked command
svnserve Configuration Reference
General configuration
Cyrus SASL configuration
httpd, the Apache HTTP Server
Prerequisites
Basic Apache Configuration
Authentication Options
Basic authentication
Digest authentication
Authorization Options
Blanket access control
Per-directory access control
Disabling path-based checks
Versioned in repository access files
Protecting network traffic with SSL
Subversion server SSL certificate configuration
Subversion client SSL certificate management
Tuning for Performance
KeepAlive
Bulk updates
Extra Goodies
Repository browsing
Apache logging
Write-through proxying
Other Apache features
Subversion Apache HTTP Server Configuration Reference
mod_dav_svn configuration directives
mod_authz_svn configuration directives
Path-Based Authorization
Getting Started with Path-Based Access Control
Access Control Groups
Username Aliases
Advanced Access Control Features
Some Gotchas with Access Control
High-level Logging
Server Optimization
Data Caching
Network Compression of Data
Supporting Multiple Repository Access Methods
7. Customizing Your Subversion Experience
Runtime Configuration Area
Configuration Area Layout
Configuration and the Windows Registry
Runtime Configuration Options
General configuration
Per-server configuration
Localization
Understanding Locales
Subversion's Use of Locales
Using External Editors
Using External Differencing and Merge Tools
External diff
External diff3
External merge
Summary
8. Embedding Subversion
Layered Library Design
Repository Layer
Repository Access Layer
Client Layer
Using the APIs
The Apache Portable Runtime Library
Functions and Batons
URL and Path Requirements
Using Languages Other Than C and C++
Code Samples
Summary
II. Lệnh Tham Khảo Subversion
I. svn Reference—Subversion Command-Line Client
svn add
svn blame (praise, annotate, ann)
svn cat
svn changelist (cl)
svn checkout (co)
svn cleanup
svn commit (ci)
svn copy (cp)
svn delete (del, remove, rm)
svn diff (di)
svn export
svn help (h, ?)
svn import
svn info
svn list (ls)
svn lock
svn log
svn merge
svn mergeinfo
svn mkdir
svn move (mv)
svn patch
svn propdel (pdel, pd)
svn propedit (pedit, pe)
svn propget (pget, pg)
svn proplist (plist, pl)
svn propset (pset, ps)
svn relocate
svn resolve
svn resolved
svn revert
svn status (stat, st)
svn switch (sw)
svn unlock
svn update (up)
svn upgrade
II. svnadmin Reference—Subversion Repository Administration
svnadmin crashtest
svnadmin create
svnadmin deltify
svnadmin dump
svnadmin freeze
svnadmin help (h, ?)
svnadmin hotcopy
svnadmin list-dblogs
svnadmin list-unused-dblogs
svnadmin load
svnadmin lock
svnadmin lslocks
svnadmin lstxns
svnadmin pack
svnadmin recover
svnadmin rmlocks
svnadmin rmtxns
svnadmin setlog
svnadmin setrevprop
svnadmin setuuid
svnadmin unlock
svnadmin upgrade
svnadmin verify
III. svnlook Reference—Subversion Repository Examination
svnlook author
svnlook cat
svnlook changed
svnlook date
svnlook diff
svnlook dirs-changed
svnlook filesize
svnlook help (h, ?)
svnlook history
svnlook info
svnlook lock
svnlook log
svnlook propget (pget, pg)
svnlook proplist (plist, pl)
svnlook tree
svnlook uuid
svnlook youngest
IV. svnserve Reference—Custom Subversion Server
svnserve
V. svnversion Reference—Subversion Working Copy Version Info
svnversion
VI. svnsync Reference—Subversion Repository Mirroring
svnsync copy-revprops
svnsync help
svnsync info
svnsync initialize (init)
svnsync synchronize (sync)
VII. svnrdump Reference—Remote Subversion Repository Data Migration
svnrdump dump
svnrdump help
svnrdump load
VIII. svndumpfilter Reference—Subversion History Filtering
svndumpfilter exclude
svndumpfilter include
svndumpfilter help
IX. svnmucc Reference—Subversion Multiple URL Command Client
svnmucc
X. Subversion Repository Hook Reference
start-commit
pre-commit
post-commit
pre-revprop-change
post-revprop-change
pre-lock
post-lock
pre-unlock
post-unlock
III. Phụ Lục
A. Subversion Quick-Start Guide
Installing Subversion
High-Speed Tutorial
B. Subversion for CVS Users
Revision Numbers Are Different Now
Directory Versions
More Disconnected Operations
Distinction Between Status and Update
Status
Update
Branches and Tags
Metadata Properties
Conflict Resolution
Binary Files and Translation
Versioned Modules
Authentication
Converting a Repository from CVS to Subversion
C. WebDAV and Autoversioning
What Is WebDAV?
Autoversioning
Client Interoperability
Standalone WebDAV Applications
Microsoft Office, Dreamweaver, Photoshop
cadaver, DAV Explorer
File-Explorer WebDAV Extensions
Microsoft Web Folders
Nautilus, Konqueror
WebDAV Filesystem Implementation
WebDrive, NetDrive
Mac OS X
Linux davfs2
D. The Berkeley DB Legacy Filesystem
Configuring Your Berkeley DB Environment
Limitations of Berkeley DB
Architectural Limitations
Network Share Deployment
Fault Tolerance and the Need for Recovery
Maintaining Berkeley DB Repositories
Berkeley DB Recovery
Purging unused Berkeley DB logfiles
Berkeley DB Utilities
E. Quyền tác giả
Index

List of Figures

1. Kiến trúc Subversion
1.1. Một hệ thống chủ/khách kinh điển
1.2. Vấn đề cần tránh
1.3. Giải pháp khoá-sửa đổi-mở khoá
1.4. Giải pháp sao chép-sửa đổi-hợp nhất
1.5. Giải pháp sao chép-sửa đổi-hợp nhất (tiếp theo)
1.6. Cây thay đổi theo thời gian
1.7. Hệ thống tập tin của kho lưu trữ
4.1. Branches of development
4.2. Starting repository layout
4.3. Repository with new copy
4.4. The branching of one file's history
8.1. Files and directories in two dimensions
8.2. Versioning time—the third dimension!

List of Tables

1.1. URL truy cập kho lưu trữ
2.1. Một vài lệnh log thông dụng
4.1. Branching and merging commands
6.1. Comparison of Subversion server options
C.1. Common WebDAV clients

List of Examples

4.1. Merge-tracking gatekeeper start-commit hook script
5.1. hooks-env (custom hook script environment configuration)
5.2. start-commit hook to require merge tracking support
5.3. txn-info.sh (reporting outstanding transactions)
5.4. Mirror repository's pre-revprop-change hook script
5.5. Mirror repository's start-commit hook script
6.1. A sample svnserve launchd job definition
6.2. A sample configuration for anonymous access
6.3. A sample configuration for authenticated access
6.4. A sample configuration for mixed authenticated/anonymous access
6.5. Disabling path checks altogether
6.6. Using single versioned in repo access file
6.7. Using per repository in repo access files
7.1. Sample registration entries (.reg) file
7.2. diffwrap.py
7.3. diffwrap.bat
7.4. diff3wrap.py
7.5. diff3wrap.bat
7.6. mergewrap.py
7.7. mergewrap.bat
8.1. Using the repository layer
8.2. Using the repository layer with Python
8.3. A Python status crawler