Version Control with Subversion for Subversion 1.4 (Compiled from R2639)
Total Page:16
File Type:pdf, Size:1020Kb
Version Control with Subversion For Subversion 1.4 (Compiled from r2639) Ben Collins-Sussman Brian W. Fitzpatrick C. Michael Pilato Version Control with Subversion: For Subversion 1.4: (Compiled from r2639) by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato Published (TBA) Copyright © 2002, 2003, 2004, 2005, 2006, 2007 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 ....................................................................................xiv Conventions Used in This Book .......................................................................xiv Typographic Conventions ........................................................................xiv Icons ...................................................................................................... xv 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 .......................................................................... xviii What is Subversion? ..................................................................................... xviii Subversion's History ............................................................................. xviii Subversion's Features .............................................................................xix Subversion's Architecture ........................................................................ xx Subversion's Components .......................................................................xxi 1. Fundamental Concepts .........................................................................................1 The Repository .................................................................................................1 Versioning Models ............................................................................................2 The Problem of File-Sharing ......................................................................2 The Lock-Modify-Unlock Solution ...............................................................3 The Copy-Modify-Merge Solution ...............................................................5 Subversion in Action .........................................................................................7 Subversion Repository URLs .....................................................................7 Working Copies ........................................................................................8 Revisions ...............................................................................................11 How Working Copies Track the Repository ............................................... 12 Mixed Revision Working Copies ............................................................... 13 Summary .......................................................................................................14 2. Basic Usage .......................................................................................................16 Help! ..............................................................................................................16 Import ............................................................................................................16 Time Travel with Subversion ............................................................................ 16 Initial Checkout ............................................................................................... 17 Basic Work Cycle ........................................................................................... 19 Update Your Working Copy ..................................................................... 19 Make Changes to Your Working Copy ...................................................... 20 Examine Your Changes .......................................................................... 22 Resolve Conflicts (Merging Others' Changes) ........................................... 28 Commit Your Changes ............................................................................ 31 Examining History ........................................................................................... 32 svn log ..................................................................................................33 svn diff ..................................................................................................34 svn cat ..................................................................................................36 svn list ..................................................................................................36 A Final Word on History .......................................................................... 37 Other Useful Commands ................................................................................. 37 svn cleanup ..........................................................................................37 svn import .............................................................................................38 iv Version Control with Subversion Summary .......................................................................................................38 3. Advanced Topics ................................................................................................ 39 Revision Specifiers ......................................................................................... 39 Revision Keywords ................................................................................. 39 Revision Dates ....................................................................................... 40 Properties ......................................................................................................41 Why Properties? ..................................................................................... 42 Manipulating Properties ........................................................................... 43 Properties and the Subversion Workflow .................................................. 46 Automatic Property Setting ...................................................................... 47 File Portability ................................................................................................. 48 File Content Type ................................................................................... 48 File Executability ..................................................................................... 49 End-of-Line Character Sequences ........................................................... 50 Ignoring Unversioned Items ............................................................................. 51 Keyword Substitution ...................................................................................... 54 Locking ..........................................................................................................57 Creating locks ........................................................................................ 59 Discovering locks .................................................................................... 61 Breaking and stealing locks ..................................................................... 62 Lock Communication .............................................................................. 64 Externals Definitions ....................................................................................... 65 Peg and Operative Revisions .......................................................................... 68 4. Branching and Merging ....................................................................................... 72 What's a Branch? ........................................................................................... 72 Using Branches .............................................................................................. 72 Creating a Branch ................................................................................... 74 Working with Your Branch ....................................................................... 76 The Key Concepts Behind Branches ........................................................ 79 Copying Changes Between Branches .............................................................. 79 Copying Specific Changes ...................................................................... 79 The Key Concept Behind Merging ............................................................ 82 Best Practices for Merging .....................................................................