TweetFollow Us on Twitter

Oct 00 Online

Volume Number: 16 (2000)
Issue Number: 10
Column Tag: MacTech Online

CVS: Version Control is Your Friend

by Jeff Clites <online@mactech.com>

CVS, the Concurrent Versions System, is the standard in version control systems in the Unix world. Traditional Mac users may not have used CVS before, and in fact may not have used any version control system, but it can save you numerous headaches during your development projects, and with the arrival of Mac OS X there is no longer any excuse-CVS is free and may even come preinstalled with your developer tools.

So what is a version control system? In short, it allows you to manage and track changes to the files of a project. From an operational standpoint, most systems (including CVS) are based on a central repository which contains all of the files of your project, and individual developers "check out" copies of these files, make changes to their local copies, and then "check in" their changes to the central repository. In the process, the system does three basic things for you: it helps coordinate a team of developers working on the same project (so that programmers don't interfere with other programmers working on the same files); it tracks what changes were made to what file, when they were made, why they were made, and who made them (this helps you identify the cause of a newly introduced bug and helps enforce developer accountability); and it allows you to revert to a version of your project that existed at some previous point in time (this allows you to test compatibility with previous versions or to undo destabilizing changes). Version control isn't a magic bullet or a substitute for communication between developers, but it does go a long way toward preventing common (and annoying) problems. Version control is a must when multiple developers are involved in a project, but even a single developer working alone will benefit.

The main advantage that CVS has over most if its competitors is that it uses optimistic locking rather than pessimistic locking for checked-out file. With pessimistic locking, only one developer can check out and modify a given file at one time, in order to prevent two users from stepping on each others changes in the same file. This sounds like a good idea on the surface, but in practice it can become a major impediment if users keep files checked out for long periods of time, as they would naturally do when editing them, or as they may accidentally do if they forget to check them backing in before leaving for lunch, for the day, or for vacation. Ultimately, users will resort to circumventing the system to obtain a copy of a "locked" file so that they can get some work done, and they'll have to manually reconcile their changes with the user who originally checked out the file. CVS takes a completely different approach-it doesn't lock access to files at all. Multiple users are free to check out and work on the same files at the same time, and the system takes care of merging changes together as users commit their modifications back into the central repository. The majority of the time, users don't actually end up editing the same files at the same time (even though they may have checked them out, for instance to look them over for needed changes), and even when they do CVS is able to merge these changes together automatically. In the rare case in which two users have both modified the same line of code between check-ins, CVS notifies the user of a conflict so that he can resolve it manually. This sound like it could cause a mess, but in practice it usually does just what you would have wanted, and it only makes you spend your time resolving the rare conflict when it actually does occur, rather than causing ongoing interruptions in order to ward off potential problems that never actually arise.

CVS has many strong points in addition to the above-mentioned "non-locking" behavior. For instance, it is open source and licensed under the GPL, and therefore is available free of charge. Also, despite its Unix heritage, there are GUI-based clients available for the classic Mac OS and for Windows. On the other hand, CVS is far from perfect-it has been said that it's terrible but it's the best thing around. Many if its flaws are merely nits, but they can add up to a noticeable inconvenience. To begin with, CVS shares a problem which is unfortunately common among open-source projects, namely that it has a significant amount of documentation yet it is often difficult to find the exact information you are looking for. For example, a very nice feature of CVS is that it can be configure to run over SSH, so that passwords and data are encrypted during transmission. It's hard to find a complete discussion of this feature, and the setup is such that it's easy to think that you've enabled this feature when in fact you haven't. (There also doesn't appear to be a way to force the use of SSH from the server side, i.e. to ensure that clients cannot connect insecurely.)

A second annoyance is the somewhat inconvenient handling of directories. CVS fundamentally works on a per-directory basis, and in each directory it places a "CVS" subdirectory with configuration information. This can cause problems if you duplicate a directory and forget to remove the duplicate CVS information. Under Mac OS X there are many types of "files" which are actually directories, and tools which manipulate these need to be CVS-aware so that they don't remove the CVS information when saving. Some of these "magic directories" (for instance InterfaceBuilder's .nib files) are best thought of as opaque binary files, whose contents should not be manipulated by merge tools, and there is a "wrappers" facility which allows you to treat them as such but, inexplicably, this feature is not compatible with client-server operation. Fortunately, Codefab maintains a modified version of CVS which does support both of these features, although it's a shame that the CVS maintainers don't seem to be interested in merging this back into the core distribution. This still doesn't solve the problem for "magic directories" which you don't want to treat as binary (such as EOModeler's .eomodeld files), but fortunately the latest incarnations of Apple's developer tools seem to handle the CVS directories correctly. For older version, the Omni Group has plug-ins which fix this problem, for both EOModeler and InterfaceBuilder. The directory-centric nature of CVS also has the unpleasant side-effect that you can't really remove a directory from you project - you can only remove the files which it contains. There is a workaround in that there is a setting which tells CVS not to create empty directories during a checkout, but this has the side effect that you can't place an empty directory under version control. (It's rare that you would need to, but it's important to keep in mind in case you ever do.) On a related note, you can place binary files (such as images) under version control, but you have to go through a bit of special configuration to flag them as binary so that CVS doesn't corrupt them, for instance by doing line-ending conversion. Often, these types of files do not really need to be under version-control per se, but it's very convenient to place them in your repository nonetheless so that you can maintain a complete copy of your project, especially in web development projects which tend to contain a large number of image files.

Documentation

Apple itself uses CVS for some of its internal development projects, and in fact Mac OS X Server shipped with it pre-installed. In particular it is used with the Darwin project, and there is a page on their Public Source site which serves as a good jumping-off point to find documentation and other information about CVS. Here you'll find a brief introduction to CVS concepts, by Apple's Wilfredo Sánchez. A good next stop is Jim Blandy's "Introduction to CVS", which goes into a bit more detail. Next up is "Open Source Development with CVS", a book by Karl Fogel. Generously, although this is a commercial book, the chapters on CVS itself are available for free in a variety of electronic formats. It is extensive, well-written, and a pleasant read. Finally, there is the core CVS manual, "Version Management with CVS", colloquially referred to as "the Cederqvist", for the name of its original author. It is large and complete, but it may not be the best place to start out. Finally, for an account of using CVS specifically with web development projects, take a look at "CVS Version Control for Web Site Projects".

Much of the core documentation is located on the main CVS site, CVShome.org, and it's a good place to look for additional information and to download CVS itself, despite the somewhat inconvenient organization of the site. Their documentation page has links to the most important references, including overviews of CVS and of version control, and a CVS commands quick reference. (O'Reilly has also just published their CVS Pocket Reference, if you'd like something a little more extensive and in printed form.) Also check out the CVS Bubbles site, and especially its documentation page, which has links to a number of tutorials and to other CVS sites.

Alternatives

If you're a classic Mac OS user, you'll have to run the CVS server on a Unix machine, but there are several different clients that you can run: MacCVS Pro, MacCvs, and MacCVSClient. Despite their similar names, these are separate applications. The first of these, MacCVS Pro, is sponsored by the Mozilla project, and appears to be the most current version.

Under Mac OS X, CVS should work "out of the box" thanks to the BSD layer. If you don't like the command-line version (which really is quite easy to use), there is a GUI front end, CVL (Concurrent Versions Librarian) by Sen:te. CVL works on top of the standard CVS rather than replacing it. This is nice, because it should be forward-compatible, and it also means that you can resort to the command-line version if there is some additional feature you need to use which CVL doesn't support, and you can do this without worrying that you might "mess up" any of the locally-stored administrative information.

Finally, if CVS isn't to your liking after you've tried it out, there are several alternatives, and you might want to use one of the commercial systems. For the classic Mac OS there is VOODOO (Versions of Outdated Documents Organized Orthogonally). If you need support for multiple platforms, take a look at Perforce, which seems to be well liked and is available for a wide range of operating systems, although there don't appear to be any GUI-based clients for it. (While visiting Perforce's site you might also want to check out JAM, which is a build system designed as an alternative to make, and which is used as the build system under Mac OS X's ProjectBuilder.)

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.