Version Control with Subversion Draft Revision 8263
Total Page:16
File Type:pdf, Size:1020Kb
Version Control with Subversion Draft Revision 8263 Ben Collins-Sussman Brian W. Fitzpatrick C. Michael Pilato Version Control with Subversion: Draft Revision 8263 by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato Published (TBA) Table of Contents Preface.........................................................................................................................................11 Audience ..............................................................................................................................11 How to Read this Book ........................................................................................................... 11 Conventions Used in This Book ................................................................................................ 12 ThisBookisFree ...................................................................................................................12 Acknowledgments ..................................................................................................................12 1.Introduction ...............................................................................................................................1 What is Subversion? ...............................................................................................................1 Subversion'sHistory ...............................................................................................................1 Subversion'sFeatures ..............................................................................................................1 InstallingSubversion ..............................................................................................................2 Subversion'sComponents ........................................................................................................2 Client Components (for the User) ...................................................................................... 3 Server Components (for the Administrator) ......................................................................... 3 2.BasicConcepts ...........................................................................................................................4 TheRepository ......................................................................................................................4 VersioningModels .................................................................................................................5 The Problem of File-Sharing ............................................................................................ 5 The Lock-Modify-Unlock Solution ....................................................................................5 The Copy-Modify-Merge Solution ....................................................................................7 Subversion in Action ..............................................................................................................9 WorkingCopies .............................................................................................................9 Revisions......................................................................................................................13 How Working Copies Track the Repository ........................................................................ 15 The Limitations of Mixed Revisions .................................................................................. 15 Summary..............................................................................................................................16 3.GuidedTour ..............................................................................................................................17 Help! ...................................................................................................................................17 Import..................................................................................................................................17 Revisions: Numbers, Keywords, and Dates, Oh My! ..................................................................... 17 RevisionNumbers ..........................................................................................................17 RevisionKeywords ........................................................................................................17 RevisionDates ..............................................................................................................18 InitialCheckout .....................................................................................................................19 Basic Work Cycle ..................................................................................................................21 Update Your Working Copy ............................................................................................. 22 Make Changes to Your Working Copy ............................................................................... 22 Examine Your Changes ...................................................................................................23 Resolve Conflicts (Merging Others' Changes) ...................................................................... 28 Commit Your Changes ....................................................................................................32 ExaminingHistory .................................................................................................................33 svnlog .........................................................................................................................33 svndiff ........................................................................................................................35 svncat .........................................................................................................................36 svnlist .........................................................................................................................37 A Final Word on History ................................................................................................. 37 Other Useful Commands .........................................................................................................37 svncleanup ...................................................................................................................37 svnimport ....................................................................................................................38 Summary..............................................................................................................................38 4. Branching and Merging ............................................................................................................... 39 What'saBranch? ...................................................................................................................39 UsingBranches .....................................................................................................................40 iv Version Control with Subversion Creating a Branch ..........................................................................................................41 Working with Your Branch .............................................................................................. 43 The Moral of the Story .................................................................................................... 45 Copying Changes Between Branches ......................................................................................... 45 Copying Specific Changes ...............................................................................................46 The Repeated Merge Problem ........................................................................................... 48 Merging an Entire Branch ................................................................................................ 48 Removing a Change from the Repository .................................................................................... 49 Switching a Working Copy ...................................................................................................... 50 Tags ....................................................................................................................................51 Creating a Simple Tag ..................................................................................................... 51 Creating a Complex Tag .................................................................................................. 52 BranchMaintenance ...............................................................................................................52 RepositoryLayout ..........................................................................................................53 DataLifetimes ...............................................................................................................53 Summary..............................................................................................................................54 5. Repository Administration ............................................................................................................55 RepositoryBasics...................................................................................................................55 Understanding Transactions and Revisions .........................................................................