(Compiled from r6046) For Subversion 1

Version Control with Subversion

For Subversion 1.7

(Compiled from r6065)

Ben Collins-Sussman

Brian W. Fitzpatrick

C. Michael Pilato

Version Control with Subversion: For Subversion 1.7: (Compiled from r6065)

by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato

Copyright ? 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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

Foreword .............................................................................................................................................................. xi

Preface ............................................................................................................................................................... xiii

What Is Subversion? .................................................................................................................................... xiii

Is Subversion the Right Tool? ............................................................................................................... xiii

Subversion's History ............................................................................................................................. xiv

Subversion's Architecture ....................................................................................................................... xv

Subversion's Components ..................................................................................................................... xvii

What's New in Subversion ................................................................................................................... xvii

Audience .................................................................................................................................................. xviii

How to Read This Book ............................................................................................................................... xix

Organization of This Book ............................................................................................................................. xx

This Book Is Free ........................................................................................................................................ xxi

Acknowledgments ........................................................................................................................................ xxi

1. Fundamental Concepts ......................................................................................................................................... 1

Version Control Basics .................................................................................................................................... 1

The Repository ...................................................................................................................................... 1

The Working Copy ................................................................................................................................. 2

Versioning Models ................................................................................................................................. 2

Version Control the Subversion Way ................................................................................................................. 7

Subversion Repositories ........................................................................................................................... 7

Revisions .............................................................................................................................................. 7

Addressing the Repository ....................................................................................................................... 8

Subversion Working Copies ..................................................................................................................... 9

Summary ..................................................................................................................................................... 14

2. Basic Usage ..................................................................................................................................................... 15

Help! .......................................................................................................................................................... 15

Getting Data into Your Repository .................................................................................................................. 16

Importing Files and Directories ............................................................................................................... 16

Recommended Repository Layout ........................................................................................................... 17

What's In a Name? ............................................................................................................................... 17

Creating a Working Copy .............................................................................................................................. 18

Basic Work Cycle ......................................................................................................................................... 19

Update Your Working Copy ................................................................................................................... 20

Make Your Changes .............................................................................................................................. 20

Review Your Changes ........................................................................................................................... 21

Fix Your Mistakes ................................................................................................................................ 25

Resolve Any Conflicts ........................................................................................................................... 26

Commit Your Changes .......................................................................................................................... 32

Examining History ........................................................................................................................................ 33

Examining the Details of Historical Changes ............................................................................................. 34

Generating a List of Historical Changes ................................................................................................... 35

Browsing the Repository ........................................................................................................................ 37

Fetching Older Repository Snapshots ....................................................................................................... 39

Sometimes You Just Need to Clean Up ............................................................................................................ 40

Disposing of a Working Copy ................................................................................................................ 40

Recovering from an Interruption ............................................................................................................. 40

Dealing with Structural Conflicts ..................................................................................................................... 41

An Example Tree Conflict ..................................................................................................................... 42

Summary ..................................................................................................................................................... 46

3. Advanced Topics .............................................................................................................................................. 47

Revision Specifiers ....................................................................................................................................... 47

iii

Version Control with Subversion

Revision Keywords ............................................................................................................................... 47

Revision Dates ..................................................................................................................................... 48

Peg and Operative Revisions .......................................................................................................................... 49

Properties .................................................................................................................................................... 53

Why Properties? ................................................................................................................................... 54

Manipulating Properties ......................................................................................................................... 55

Properties and the Subversion Workflow .................................................................................................. 58

Automatic Property Setting ..................................................................................................................... 60

File Portability ............................................................................................................................................. 60

File Content Type ................................................................................................................................. 61

File Executability .................................................................................................................................. 62

End-of-Line Character Sequences ............................................................................................................ 62

Ignoring Unversioned Items ............................................................................................................................ 63

Keyword Substitution .................................................................................................................................... 66

Sparse Directories ......................................................................................................................................... 70

Locking ....................................................................................................................................................... 74

Creating Locks ..................................................................................................................................... 75

Discovering Locks ................................................................................................................................ 77

Breaking and Stealing Locks .................................................................................................................. 78

Lock Communication ............................................................................................................................ 80

Externals Definitions ..................................................................................................................................... 81

Changelists .................................................................................................................................................. 87

Creating and Modifying Changelists ........................................................................................................ 87

Changelists As Operation Filters ............................................................................................................. 89

Changelist Limitations ........................................................................................................................... 91

Network Model ............................................................................................................................................ 91

Requests and Responses ......................................................................................................................... 91

Client Credentials ................................................................................................................................. 91

Summary ..................................................................................................................................................... 94

4. Branching and Merging ...................................................................................................................................... 95

What's a Branch? .......................................................................................................................................... 95

Using Branches ............................................................................................................................................ 95

Creating a Branch ................................................................................................................................. 97

Working with Your Branch .................................................................................................................... 98

The Key Concepts Behind Branching ..................................................................................................... 101

Basic Merging ............................................................................................................................................ 101

Changesets ......................................................................................................................................... 101

Keeping a Branch in Sync .................................................................................................................... 102

Subtree Merges and Subtree Mergeinfo .................................................................................................. 105

Reintegrating a Branch ......................................................................................................................... 107

Mergeinfo and Previews ....................................................................................................................... 109

Undoing Changes ................................................................................................................................ 113

Resurrecting Deleted Items ................................................................................................................... 114

Advanced Merging ...................................................................................................................................... 115

Cherrypicking ..................................................................................................................................... 115

Merge Syntax: Full Disclosure .............................................................................................................. 117

Merges Without Mergeinfo ................................................................................................................... 118

More on Merge Conflicts ..................................................................................................................... 119

Blocking Changes ............................................................................................................................... 121

Keeping a Reintegrated Branch Alive ..................................................................................................... 122

Merge-Sensitive Logs and Annotations ................................................................................................... 123

Noticing or Ignoring Ancestry ............................................................................................................... 125

Merges and Moves .............................................................................................................................. 126

Preventing Na?ve Clients from Committing Merges .................................................................................. 126

iv

Version Control with Subversion

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 .......................................................................................

svn_load_dirs.pl ..................................................................................................................................

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 ..................................................................................

Choosing a Data Store .........................................................................................................................

Creating and Configuring Your Repository ......................................................................................................

Creating the Repository ........................................................................................................................

Implementing Repository Hooks ............................................................................................................

Berkeley DB Configuration ..................................................................................................................

FSFS Configuration .............................................................................................................................

Repository Maintenance ...............................................................................................................................

An Administrator's Toolkit ...................................................................................................................

Commit Log Message Correction ...........................................................................................................

Managing Disk Space ..........................................................................................................................

Berkeley DB Recovery ........................................................................................................................

Migrating Repository Data Elsewhere .....................................................................................................

Filtering Repository History ..................................................................................................................

Repository Replication .........................................................................................................................

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 .............................................................................................................................

Built-in Authentication and Authorization ...............................................................................................

Using svnserve with SASL ..................................................................................................................

Tunneling over SSH ............................................................................................................................

SSH Configuration Tricks .....................................................................................................................

httpd, the Apache HTTP Server .....................................................................................................................

Prerequisites .......................................................................................................................................

v

127

128

129

130

130

131

131

132

132

133

133

134

135

136

137

138

140

140

141

141

143

144

146

147

147

149

149

149

149

153

153

157

158

162

165

171

173

174

174

175

175

176

176

176

177

177

178

178

182

184

186

187

188

189

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download