Save 40% on books and eBooks + 70% on videos now through May 31*—use code PROGRAM. Shop now.
In any software development project, many developers contribute changes over a period of time. Using a version control system to track and manage these changes is vital to the continued success of the project. This book introduces you to Subversion, a free, open-source version control system, which is both more powerful and much less complex than its predecessor CVS.
In this practical, hands-on guide, you will learn how to use Subversion and how to effectively merge a version control system within your development process. As a seasoned Subversion user, William Nagel draws on lessons learned through trial and error, providing useful tips for accomplishing tasks that arise in day-to-day software development. Nagel clearly explains how to expand on the built-in abilities of Subversion, making the system work better for you. He organizes Subversion commands by activity to allow for quick task reference. Using example scripts and configurations, he also includes development approaches that you can customize to fit your own environment.
Inside, you will find
Whether you are an administrator, project manager, or software developer, Subversion Version Control will show you how to realize the full potential of Subversion.
1.1 What Is Version Control? 4
1.2 Why Use It? 4
1.3 The Elements of Version Control 7
1.4 Summary 12
2.1 Why Subversion? 15
2.2 Limitations of Subversion 21
2.3 Summary 23
3.1 Installing on Linux 25
3.2 Installing on Mac OS X 29
3.3 Installing on Windows 30
3.4 Configuring SVN to Use Apache 31
3.5 Configuring to Use Svnserve 34
3.6 Summary 36
4.1 Creating the Repository 37
4.2 Getting Files into the Repository 38
4.3 Creating a Working Copy 40
4.4 Editing Files 40
4.5 Committing Changes 42
4.6 Viewing the Logs 42
4.7 Creating a Tag 43
4.8 Creating a Branch 44
4.9 Merging a Branch 46
4.10 Handling Conflicts 48
4.11 Summary 51
5.1 The Subversion Client 55
5.2 Checking Out and Maintaining a Working Copy 57
5.3 Modifying and Committing Data 61
5.4 Getting Information about the Repository 67
5.5 Changing the Working Copy Target 76
5.6 Resolving Conflicts 76
5.7 Branching, Tagging, and Merging 78
5.8 Troubleshooting the Working Copy 82
5.9 Summary 83
6.1 Storing Metadata 85
6.2 Retrieving Metadata 87
6.3 Built-in Properties 90
6.4 Summary 96
7.1 Finding the Configuration Files 97
7.2 Editing the Configuration Files 97
7.3 Summary 104
8.1 Accessing SVN through a GUI Client 105
8.2 Accessing Directly from an IDE 111
8.3 Using Autoversioning with WebDAV 114
8.4 Summary 116
9.1 Laying Out the Repository 119
9.2 Planning for Growth 126
9.3 Migrating an Existing Repository 129
9.4 Summary 136
10.1 Controlling Access to the Repository 137
10.2 Backing Up the Repository 149
10.3 Unwedging Your Repository 154
10.4 Upgrading Subversion 156
10.5 Summary 156
11.1 An Introduction to Hooks 160
11.2 Making the Most of Hook Scripts 167
11.3 Taking Advantage of Metadata 191
11.4 The Subversion API 198
11.5 Summary 206
12.1 Effective Branching and Tagging 209
12.2 Checking In Code 217
12.3 Log Data 219
12.4 Project Builds 223
12.5 Testing and Quality Assurance 227
12.6 Communication 230
12.7 Enforcing Policies 232
12.8 Summary 233
13.1 SVN in Different Developers' Workflows 235
13.2 Using SVN in Peer Reviews 240
13.3 Tying Revisions to Issue Tracking 246
13.4 Summary 249
14.1 Archetypal Studies 251
14.2 Real-world Studies 260
I was first introduced to version control (and CVS) in college, about the same time I was introduced to Linux. At that time though, most of the projects I worked on were small and generally involved only a couple of developers. So, although version control would have been useful, I never took the time to really use it; my knowledge of CVS remained limited to what little I needed to know to check out the occasional bleeding-edge project on Linux (which seemed necessary a little more often in those days). As my college career progressed, the projects I worked on became more involved, and I began to learn about "software engineering." The instruction I received on software engineering never really covered version control in any depth though, and despite the increased size of the software projects I was working on, I never delved into using a version control system to keep track of things. I wanted to; I thought CVS was a neat idea. I just never invested the timenecessary to learn how to set it up and use it. Then came my first major team project. It was a real-world project, with real-world clients, and its completion was required for graduation. Finally, I had an excuse to really give version control a try. I presented the case for CVS to my teammates and (although there was some small resistance) convinced them that we needed to use it. It was a success. By the end of the project, I was fully sold on the necessity of version control in any future projects, however big or small. I loved CVS.
After school came the real world, and the love affair with CVS didn't last long. As I learned (mostly through trial and error) how version control systems should be used, CVS steadily became more and more inadequate. I could see its potential, but it didn't measure up. Code was lost, fits were thrown, and hair was pulled. Still, CVS was the best free, open source version control system out there, and as an entrepreneur trying to keep a start-up company going, free was a required feature. Then someone told me about a new versioncontrol project called Subversion, so I went to its site and took a look. It seemed intriguing, but it wasn't quite up to the point where I could trust it for my code--and I barely had time to eat back then, so getting involved in the project's development was out of the question. Instead, Subversion went on my back burner and I moved on to other things.
Several months down the road, I saw that Subversion had become self-hosting. "Well," I thought, "If they trust it with their own code, maybe it's time to take another look." Rolling up my sleeves, I sat down to play around with it. Once again, I had fallen in love. Subversion was everything CVS could have been. It was stable, it was flexible, and it didn't eat my code. Thus, after a suitable period of testing, CVS was unceremoniously chucked and replaced by Subversion. I've never regretted the change. In fact, the only thing regrettable is the hours of my life wasted fighting with CVS.
When I was first approached about writing a book on Subversion, my first thought was, "Why?" There's already an excellent Subversion manual, written by several of the principle Subversion authors (who presumably know more about Subversion's inner workings than I do), and it's freely available at that. So, I almost turned down the opportunity to write this book because I couldn't imagine why anyone would want to read it. What could I possibly add that wasn't already written? Then I got to thinking back to my college days, when I learned version control through trial and error (mostly error). I had the manual to CVS, but it covered how to use CVS, not how to use version control. It was a good manual, it just wasn't complete. The Subversion manual is similar; although it is far, far better than the documentation available for CVS, it's still primarily a technical manual. As a technical manual, it is excellent. As a guide to realizing Subversion's full potential in relation to your software development project, it isn't complete. Therefore, I've written this book to be theguide I never had when I was learning how to use version control.
Of course, this book aims to cover the nuts and bolts of Subversion as completely as possible--you can't very well use Subversion to develop software if you can't use Subversion--but it does so in the context of how to do the things you want to do in dayto-day software development. The book also goes a step further: It explains how to expand on the built-in capabilities of Subversion to make the system work for you. In some places, that takes the form of example scripts or configurations. In others, it is merely ideas that you can expand to fit your software development process. This is not a book to sell a process. I do make suggestions here and there of what I think will work in certain situations, but you don't need to buy into my "exhalted process" to get the most from this book. Instead of showing you how you should develop your software, I show you how Subversion can make your process easier.
The book is split into five sections, each covering Subversion from a different perspective.
This first part looks at Subversion from the beginner's perspective. It explains what version control is, why it is useful, and how Subversion fits into the version control world. It shows you how to install and set up Subversion, and it walks you through Subversion's essential features.
Chapter 1 An introduction to the essential concepts that make up a version control system.
Chapter 2 An introduction to Subversion's features and how they compare to some other common version control systems.
Chapter 3 A basic guide to installing Subversion on Linux, Windows, and Mac OS X.
Chapter 4 A tutorial walkthrough of Subversion, from creating your first repository to basic branching and merging.
The second part of the book examines Subversion from the perspective of the client user. It takes a detailed look at using the most important Subversion client commands, as well as properties, user configuration, and integration with a variety of external tools.
Chapter 5 Walk through a Subversion working copy and the commands used to interact with it. Most of the common Subversion client commands are covered in this chapter.
Chapter 6 How to use the Subversion tools to work with properties attached to versioned files.
Chapter 7 A look at Subversion client configuration and customization for an individual work environment.
Chapter 8 An overview of many of the client tools that Subversion can integrate and interact with.
This is a look at Subversion from the admin's perspective. In this section, I talk about repository administration and organization. I show how to use automation to help integrate Subversion into your development process, and I examine the nuts and bolts of such things as repository security and migration from another version control system.
Chapter 9 Tips on repository organization, as well as how to migrate an old repository to Subversion with minimal loss of history and metadata.
Chapter 10 Basic repository administration: security, backup, and repository maintenance.
Chapter 11 An in-depth look at automation in Subversion, using hook scripts, metadata, and the Subversion API. Includes a number of example scripts that you can use in your project.
This part takes a look at Subversion from the project manager's perspective. It looks at the software development process and how Subversion can fit into a variety of different types of projects, with many different policies and philosophies.
Chapter 12 An overview of different policies adopted by many development projects and how Subversion can be used to complement those policies.
Chapter 13 An examination of the software development process and how Subversion can be integrated into that process.
Chapter 14 Case studies that examine both archetypal and real-world projects and their use of Subversion.
The final section is a Subversion command reference. When you need to look up something quickly, it can be difficult to sift through paragraphs of expositional language. This section takes the essential technical information from the Subversion commands and makes it easy to find quickly.