Monday, November 10, 2003

Making Sense of Source Control



Most of my development work until recently has been either
without source control (gasp!) or using Visual SourceSafe. Well, for the last year
I've been doing a lot of development, and have unsurprisingly come to really like
source control. At home, I use CVS to do things like track changes to my website,
so I can roll back if I screw something up. At work, I use it for the usual purpose:
coordinating work on the same codebase with other developers.



One of my clients is currently evaluating a new source
code control system - Borland's StarTeam. It looks pretty nice, and there's a reasonable
chance they'll implement it. Since I'm doing prototype work for them, I'm using it
exclusively right now. Having experience with CVS and one or two other non-Visual
SourceSafe products, it wasn't too hard to get used to the model. But it's going to
be a stretch for some of their developers who haven't used a merge model source control
system before, the same way it hurt my brain a bit when I moved off of SourceSafe.



One of the things that I've found helpful is to picture
the various states a file can be in as a grid. The grid tracks the state of the file
in the repository versus the state of the file in the working directory. The file
can be in one of three states in each of these two places: unchanged, changed, or
not present. "Changed" and "unchanged" are relative to the file in the other location,
so "changed" on the repository axis means that the file in the working directory has
changes relative to the working directory (i.e. someone else has checked in a new
revision since you checked it out).



Because one of the things that differs between source
control systems is the terminology, the really valuable part of the grid (for me)
is the intersections, where I record the meaning of each of the possible combinations.
Here's what the grid for StarTeam looks like:



             
                 
Working Directory

                  
     Unchanged    Changed   Not Present

                        ---------   
-------   -----------



               
Unch |   Current     Modified    Missing

Repository       Chg | Out of date    Merge  
   Missing

            Not Pres |
Not in view  Not in view    N/A



It should be fairly straightforward to substitute the
terms from your source control system for the StarTeam ones. Note that this chart
is a simplification of what's really going on - it doesn't help you figure out branching,
for example - but I found it useful as a starting point, and hopefully this will help
someone avoid one or two of the mistakes I made while getting used to the new systems.


5 comments:

  1. I've been using Vault for personal use at home, and it rocks. The single user edition is $49. I suggest giving it a look. Some of the cool things: written as a .NET app, uses web services, works in a VSS (Ci/Co) or CVS (Edit/Merge) mode. Installation was simple too. My personal preference is to not use the VS integration though, but that's probably because of my prior history of being a die-hard RCS/CVS junkie!

    ReplyDelete
  2. Almost forgot to list the place where the single user version is priced on their site: https://store.sourcegear.com/Sales/catalog.asp

    ReplyDelete
  3. I've heard lots of other people praise Vault. What about it do you like more than CVS?

    ReplyDelete
  4. Great post, the grid was very helpful!!

    ReplyDelete
  5. Thanks. If you liked that, you'll really like this:



    http://software.ericsink.com/scm/scm_intro.html

    ReplyDelete