Version Control with Subversion for Subversion 1.3 (Book Compiled from Revision 2417)
Total Page:16
File Type:pdf, Size:1020Kb
Version Control with Subversion For Subversion 1.3 (book compiled from Revision 2417) Ben Collins-Sussman Brian W. Fitzpatrick C. Michael Pilato Version Control with Subversion: For Subversion 1.3: (book compiled from Revision 2417) by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato Published (TBA) Copyright © 2002, 2003, 2004, 2005, 2006 Ben Collins-SussmanBrian W. FitzpatrickC. Michael Pilato This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit ht- tp://creativecommons.org/licenses/by/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Table of Contents Foreword ..................................................................................................................xi Preface ................................................................................................................... xiii Audience ........................................................................................................ xiii How to Read this Book ..................................................................................... xiii Conventions Used in This Book .......................................................................... xiv Typographic Conventions .......................................................................... xiv Icons ..................................................................................................... xiv Organization of This Book .................................................................................. xv This Book is Free ............................................................................................. xvi Acknowledgments ............................................................................................ xvi From Ben Collins-Sussman ....................................................................... xvii From Brian W. Fitzpatrick ........................................................................ xvii From C. Michael Pilato ............................................................................ xvii 1. Introduction .......................................................................................................... 18 What is Subversion? .......................................................................................... 18 Subversion's History .......................................................................................... 18 Subversion's Features ......................................................................................... 19 Subversion's Architecture ................................................................................... 20 Installing Subversion ......................................................................................... 21 Subversion's Components ................................................................................... 22 A Quick Start ................................................................................................... 22 2. Basic Concepts ...................................................................................................... 25 The Repository ................................................................................................. 25 Versioning Models ............................................................................................ 25 The Problem of File-Sharing ....................................................................... 26 The Lock-Modify-Unlock Solution ............................................................... 26 The Copy-Modify-Merge Solution ............................................................... 28 Subversion in Action ......................................................................................... 30 Working Copies ........................................................................................ 30 Revisions ................................................................................................. 32 How Working Copies Track the Repository ................................................... 34 Mixed Revision Working Copies .................................................................. 35 Summary ......................................................................................................... 36 3. Guided Tour ......................................................................................................... 37 Help! .............................................................................................................. 37 Import ............................................................................................................. 37 Revisions: Numbers, Keywords, and Dates, Oh My! ................................................ 37 Revision Numbers ..................................................................................... 37 Revision Keywords ................................................................................... 38 Revision Dates ......................................................................................... 39 Initial Checkout ................................................................................................ 40 Basic Work Cycle ............................................................................................. 42 Update Your Working Copy ........................................................................ 42 Make Changes to Your Working Copy .......................................................... 43 Examine Your Changes .............................................................................. 44 Resolve Conflicts (Merging Others' Changes) ................................................. 50 Commit Your Changes ............................................................................... 53 Examining History ............................................................................................ 54 svn log .................................................................................................... 55 svn diff ................................................................................................... 56 svn cat .................................................................................................... 58 svn list .................................................................................................... 58 A Final Word on History ............................................................................ 59 iv Version Control with Subversion Other Useful Commands .................................................................................... 59 svn cleanup ............................................................................................. 59 svn import .............................................................................................. 60 Summary ......................................................................................................... 60 4. Branching and Merging .......................................................................................... 61 What's a Branch? .............................................................................................. 61 Using Branches ................................................................................................ 61 Creating a Branch ..................................................................................... 63 Working with Your Branch ......................................................................... 65 The Key Concepts Behind Branches ............................................................. 67 Copying Changes Between Branches .................................................................... 67 Copying Specific Changes .......................................................................... 68 The Key Concept Behind Merging ............................................................... 70 Best Practices for Merging .......................................................................... 71 Common Use-Cases .......................................................................................... 74 Merging a Whole Branch to Another ............................................................. 74 Undoing Changes ...................................................................................... 76 Resurrecting Deleted Items ......................................................................... 77 Common Branching Patterns ....................................................................... 78 Switching a Working Copy ................................................................................. 80 Tags ............................................................................................................... 82 Creating a Simple Tag ................................................................................ 82 Creating a Complex Tag ............................................................................. 82 Branch Maintenance .......................................................................................... 83 Repository Layout ..................................................................................... 83 Data Lifetimes .......................................................................................... 84 Summary ......................................................................................................... 85 5. Repository Administration ......................................................................................