| Title: | Pragmatic Version Control: Using CVS |
| Authors: | David Thomas and Andrew Hunt |
| Publisher: | The Pragmatic Bookshelf |
| Pages: | 159 |
| Reviewer: | Ed Summers |
| Synopsis: | A delightful discussion of why revision control is important, how to use CVS, and insights into effective software development. |
| Table of Contents | 1. Introduction ; 2. What is Version Control ; 3 Getting Started ; 4. How to ; 5. Accessing the Repository ; 6. Common CVS Commands ; 7. Using Tags and Branches ; 8. Creating a Project ; 9. Using Modules ; 10. Third Party Code ; A. CVS Summary and Recipes ; B. Other Resources |
When I was first introduced to CVS four years ago I was working in an environment where web applications were being built directly on the production server. To make matters worse, when we wanted to release some code we just copied the file (or files) in question, edited them and moved them back into place. Sometimes we had to edit several files, so we had to move them all really quickly. We had nightmarish directory listings where you couldn't be certain what was the real code, and what was dead wood. After a few serious mistakes we started using CVS. I learned the basics, and bookmarked the Cederqvist and tried to forget the horror of life before CVS. But in hindsight I can see we still didn't take full advantage of CVS.
I hope I'm wrong, but I imagine that there are still quite a few shops (especially web development shops) that do not use any type of revision control system. And the ones that do perhaps are using it in very rudimentary ways, or in highly complicated ways that may perhaps impede development...enter Pragmatic Version Control.
Dave Thomas and Andy Hunt of Pragmatic Programmer fame have released what they are calling their Pragmatic Starter Kit. The kit currently contains three titles: Pragmatic Version Control, Pragmatic Unit Testing, and Pragmatic Automation. The first two are currently available, and the third is due to be published in 2004. I was a bit suprised when I received the first title, Pragmatic Version Control, a slim 159 pages, which makes it about .19 cents per page. The good news is that the book is worth every penny, and it's slimness is in fact a testament to a clear concise writing style, and a well defined focus.
I have to admit at this point that I'm biased, because the Pragmatic Programmer has changed the way I think about my profession; and the 70 fortune cookie like tips at the end continue to enrich my work each day. Pragmatic Version Control continues in this tradition by not only presenting the how of version control (which is done expertly), but more importantly the why of version control. Right from the start they had me hooked:
When done right, version control is like breathing; you just don't notice doing it, but it keeps your project alive.and
Version control is a project-wide time machine, allowing you to dial in a date and see exactly what the project looked like on that date. This is useful for research, but it is essential for going back and regenerating prior releases for customers with problems.
The book's first few chapters introduce what version control is, not what CVS, RCS or Subversion are. This is important, since the focus is on the idea of version control, the problems it solves, and common terminology such as: repository, project, module, branch, tag, commit...instead of the details of a particular technology. This is all done in their light and inventive style which make what could be dry subject come alive.
With the basics covered the book moves on to examine CVS in order to show a particular implementation of a version control system. The authors again get good marks for not choosing a side in a religious debate about CVS, RCS or Subversion, or [INSERT YOUR VERSION CONTROL SYSTEM HERE], but focus on the solutions that are provided by a system. The details of creating a repository, getting code out of the repository, putting code back in, rolling back the clock to look at previous versions of project are covered, while providing practical real life examples (to be honest I think most were Flintstone characters) that illustrate how the techniques are used.
I expanded my CVS repetoire quite a bit, granted I have just tended to use a handful of commands in the past. Here are a few:
- the difference between pserver and ext for remote access
- looking at log notes for a specified time period: cvs log -d "2 days ago" -d "today"
- storing binary files in your repository: cvs add -kb file.jpg
- rolling back to previous versions without futzing with sticky tags: cvs update -j1.4 -j1.3 file.pl
- generating patches with cvs: cvs diff -u >diff.list
- using .cvswrappers to treat files with particular file extensions (.class, .jpg, etc) in special ways
But by far the most useful section to me was the discussion of how to generate releases using branches and tagging. The book provides some easy to follow recipes for effectively using branches to generate releases without having to freeze your code base (and bring development to a standstill). The authors also caution against excessive use of branches and tagging, which can create a tangled web of code that is difficult to unravel.
In summary, go buy this book :) If you are new to revision control this is the book for you since it starts with the all important concepts before moving into implementation. And if you are a seasoned user of a revision control system you will welcome Andy and Dave's insights into how best to design and implement your repository. Along the way you might learn a command or two that you didn't know already too. I just wish that since CVS is like a time machine that it would allow you to checkout your code from the future...it sure would make development easier, assuming your project succeeds of course. If you use a version control system your chances will be alot better.
