Version Control with Subversion

For Subversion 1.4

(Compiled from r2866)

Ben Collins-Sussman

Brian W. Fitzpatrick

C. Michael Pilato

This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.


Table of Contents

How to Read this Book
Conventions Used in This Book
Typographic Conventions
Organization of This Book
This Book is Free
From Ben Collins-Sussman
From Brian W. Fitzpatrick
From C. Michael Pilato
What is Subversion?
Subversion's History
Subversion's Features
Subversion's Architecture
Subversion's Components
1. Fundamental Concepts
The Repository
Versioning Models
The Problem of File-Sharing
The Lock-Modify-Unlock Solution
The Copy-Modify-Merge Solution
Subversion in Action
Subversion Repository URLs
Working Copies
How Working Copies Track the Repository
Mixed Revision Working Copies
Updates and Commits are Separate
Mixed revisions are normal
Mixed revisions are useful
Mixed revisions have limitations
2. Basic Usage
Getting Data into your Repository
svn import
Recommended repository layout
Initial Checkout
Disabling Password Caching
Authenticating as a Different User
Basic Work Cycle
Update Your Working Copy
Make Changes to Your Working Copy
Examine Your Changes
See an overview of your changes
Examine the details of your local modifications
Undoing Working Changes
Resolve Conflicts (Merging Others' Changes)
Merging Conflicts by Hand
Copying a File Onto Your Working File
Punting: Using svn revert
Commit Your Changes
Examining History
Generating a list of historical changes
Examining the details of historical changes
Examining Local Changes
Comparing Working Copy to Repository
Comparing Repository to Repository
Browsing the repository
svn cat
svn list
Fetching older repository snapshots
Sometimes You Just Need to Clean Up
3. Advanced Topics
Revision Specifiers
Revision Keywords
Revision Dates
Why Properties?
Manipulating Properties
Properties and the Subversion Workflow
Automatic Property Setting
File Portability
File Content Type
File Executability
End-of-Line Character Sequences
Ignoring Unversioned Items
Keyword Substitution
Creating locks
Discovering locks
Breaking and stealing locks
Lock Communication
Externals Definitions
Peg and Operative Revisions
Network Model
Requests and Responses
Client Credentials Caching
4. Branching and Merging
What's a Branch?
Using Branches
Creating a Branch
Working with Your Branch
The Key Concepts Behind Branches
Copying Changes Between Branches
Copying Specific Changes
The Key Concept Behind Merging
Best Practices for Merging
Tracking Merges Manually
Previewing Merges
Merge Conflicts
Noticing or Ignoring Ancestry
Merges and Moves
Common Use-Cases
Merging a Whole Branch to Another
Undoing Changes
Resurrecting Deleted Items
Common Branching Patterns
Release Branches
Feature Branches
Traversing Branches
Creating a Simple Tag
Creating a Complex Tag
Branch Maintenance
Repository Layout
Data Lifetimes
Vendor branches
General Vendor Branch Management Procedure
5. Repository Administration
The Subversion Repository, Defined
Strategies for Repository Deployment
Planning Your Repository Organization
Deciding Where and How to Host Your Repository
Choosing a Data Store
Berkeley DB
Creating and Configuring Your Repository
Creating the Repository
Implementing Repository Hooks
Berkeley DB Configuration
Repository Maintenance
An Administrator's Toolkit
Berkeley DB Utilities
Commit Log Message Correction
Managing Disk Space
How Subversion saves disk space
Removing dead transactions
Purging unused Berkeley DB logfiles
Berkeley DB Recovery
Migrating Repository Data Elsewhere
Filtering Repository History
Repository Replication
Repository Backup
6. Server Configuration
Choosing a Server Configuration
The svnserve Server
svnserve over SSH
The Apache HTTP Server
svnserve, a custom server
Invoking the Server
svnserve as Daemon
svnserve via inetd
svnserve over a Tunnel
svnserve as Windows Service
Built-in authentication and authorization
Create a 'users' file and realm
Set access controls
Tunneling over SSH
SSH configuration tricks
Initial setup
Controlling the invoked command
httpd, the Apache HTTP server
Basic Apache Configuration
Authentication Options
Basic HTTP Authentication
SSL Certificate Management
Authorization Options
Blanket Access Control
Per-Directory Access Control
Disabling Path-based Checks
Extra Goodies
Repository Browsing
Apache Logging
Other Features
Path-Based Authorization
Supporting Multiple Repository Access Methods
7. Customizing Your Subversion Experience
Runtime Configuration Area
Configuration Area Layout
Configuration and the Windows Registry
Configuration Options
Understanding locales
Subversion's use of locales
Using External Differencing Tools
External diff
External diff3
8. Embedding Subversion
Layered Library Design
Repository Layer
Repository Access Layer
Client Layer
Inside the Working Copy Administration Area
The Entries File
Pristine Copies and Property Files
Using the APIs
The Apache Portable Runtime Library
URL and Path Requirements
Using Languages Other than C and C++
Code Samples
9. Subversion Complete Reference
The Subversion Command Line Client: svn
svn Options
svn Subcommands
svn add
svn blame
svn cat
svn checkout
svn cleanup
svn commit
svn copy
svn delete
svn diff
svn export
svn help
svn import
svn info
svn list
svn lock
svn log
svn merge
svn mkdir
svn move
svn propdel
svn propedit
svn propget
svn proplist
svn propset
svn resolved
svn revert
svn status
svn switch
svn unlock
svn update
svnadmin Options
svnadmin Subcommands
svnadmin create
svnadmin deltify
svnadmin dump
svnadmin help
svnadmin hotcopy
svnadmin list-dblogs
svnadmin list-unused-dblogs
svnadmin load
svnadmin lslocks
svnadmin lstxns
svnadmin recover
svnadmin rmlocks
svnadmin rmtxns
svnadmin setlog
svnadmin verify
svnlook Options
svnlook Subcommands
svnlook author
svnlook cat
svnlook changed
svnlook date
svnlook diff
svnlook dirs-changed
svnlook help
svnlook history
svnlook info
svnlook lock
svnlook log
svnlook propget
svnlook proplist
svnlook tree
svnlook uuid
svnlook youngest
svnsync Options
svnsync Subcommands
svnsync copy-revprops
svnsync initialize
svnsync synchronize
svnserve Options
mod_dav_svn Configuration Directives
Subversion properties
Versioned Properties
Unversioned Properties
Repository Hooks
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
Branches and Tags
Metadata Properties
Conflict Resolution
Binary Files and Translation
Versioned Modules
Converting a Repository from CVS to Subversion
C. WebDAV and Autoversioning
What is WebDAV?
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. Third Party Tools
E. Copyright

List of Figures

1. Subversion's Architecture
1.1. A typical client/server system
1.2. The problem to avoid
1.3. The lock-modify-unlock solution
1.4. The copy-modify-merge solution
1.5. The copy-modify-merge solution (continued)
1.6. The repository's filesystem
1.7. The repository
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. Repository Access URLs
5.1. Repository Data Store Comparison
6.1. Comparison of Subversion Server Options
C.1. Common WebDAV Clients

List of Examples

5.1. (Reporting Outstanding Transactions)
5.2. Mirror repository's pre-revprop-change hook script
5.3. Mirror repository's start-commit hook script
6.1. A sample configuration for anonymous access.
6.2. A sample configuration for authenticated access.
6.3. A sample configuration for mixed authenticated/anonymous access.
6.4. Disabling path checks altogether
7.1. Sample Registration Entries (.reg) File.
7.3. diffwrap.bat
7.5. diff3wrap.bat
8.1. Using the Repository Layer
8.2. Using the Repository Layer with Python
8.3. A Python Status Crawler