Subversion vs. Perforce
For my money, there are only 2 decent version control systems out there right now: Subversion and Perforce. I use Subversion for MacMAME and a few other projects, and Perforce for all the work stuff. They each have their own strengths and weaknesses so it's hard to say that one is definitively better than the other. They do share one key feature that CVS lacks: atomic commits. This means that if you're checking in a bunch of changes that are encapsulated in one changelist, your operation either succeeds or it doesn't. With CVS, if the operation aborted or a file didn't check in, the repository would be in an awkward state for a period of time until you resolved the issue.
Perforce (p4) offers a compelling visual client, p4v, that gives you just about anything you could ever want in a GUI interface. It's clean, well organized and has killer diff, file history and file merge capabilities. p4 is also really powerful and has a decent CodeWarrior plugin. It deals well with Mac-specific files with resource forks as well. p4 uses an edit-change-commit workflow, which means that you have to check out a file from the repository before you can make changes to it. I don't mind this - it keeps me organized - but it causes trouble if you can't connect to your repository. You can manually unlock files and edit them, but p4 won't know that they're checked out and you have to go through hoops to tell it (I don't know of an easy way, offhand). This has caused me some problems recently -- I can't access our p4 server from 10.4 because the Cisco VPN client is busted under 10.4.
Subversion (svn) is an open-source project, and a relatively new one at that. As such, there are no GUI apps for it that are anywhere near as nice as for Perforce. Subversion does solve the offline problem that afflicts p4 - I can work on files in svn without needing to contact the server. It caches a pristine copy of the server data locally so you can edit and revert back to the server copy without ever touching the network. As such, it works fantastic when you're offline. However, this presents my main gripe with Subversion. It litters your working directories with invisible ".svn" folders. This means that if you try to copy a directory into a svn workspace, you'll blow out the existing .svn directories and Subversion will become confused. This is probably more pronounced on the Mac, because there are several cases where directories are made to look like files - .xcode projects, .bundle libraries etc. Each of these is really a directory hierarchy posing as a single file in the Finder. A few times now I've copied over a revised .xcode project "file" to my svn working copy and caused myself some grief. I don't know of an easy way to fix this situation when it happens.
Subversion's other weak spot is support for Mac resource forks. It has none. This is OK for most cases since you can use data-fork based resource files, but there are some cases where only a resource fork will do. For example, you can't check in a Finder-generated invisible "Icon" file or a ".webloc" URL file generated by Safari. My MacMAME repository contains the actual shipping "distribution", which has a .webloc file and custom icons for a few folders. Or it would, if Subversion supported resource-fork based files. ;) Instead, I have to store them in the repository as zip archives and run a shell script to post-process them when it comes time to build the distribution for release.
One interesting (and some might say annoying) feature of Subversion is that it uses the Apache 2 webserver to host a subversion server over http. OSX ships with Apache 1, so you have to install Apache 2 manually along with some other junk to get it all set up. Worse still, there appears to be a pretty major bug between 10.4 and Apache2 when it comes to pushing large files across the network. As such I've had to migrate my MacMAME server back over to a 10.3.9 box until either Apple or the Apache folks get it sorted out.
If other folks have used p4 or svn and know of ways to mitigate their weaknesses, I'd love to hear about it.
Comments
Ugh - Perforce. Do you still have to tell it you want to edit a file, instead of just editing it and then telling it later? I hated that.
Posted by: Calum Robinson | May 12, 2005 03:27 AM
We use Subversion at work, but instead of just hosting thru Apache, we most often connect thru a ssh-tunnel with the "svn+ssh" protocol. It's much faster and works like a charm.
On the other hand, it requires a ssh-account for everyone accessing and that you either change the umask for those connections or that you set the "set-user-ID-on-execution" or "set-group-ID-on-execution" on the svnserve util.
Posted by: Kent Karlsson | May 12, 2005 03:32 AM
I find offline editing of PerForce files pretty easy - just change permissions, then, when back online, simply do "p4 edit" on the changed files (or p4 diff -x to find the changed files and update depot accordingly) and you're in business. If a file has had an edit while you were offline, you'll have to do a p4 resolve, but that's nothing new. Basically, offline editing in p4 simply swaps the "p4 edit" and actual file editing steps - you do "p4 edit" *after* editing the files.
I have no experience with SVN, but I've been very, very happy with p4. One question though - does p4v still only work with mac clients (as opposed to the darwin client - we use the latter at Luxology since our modo app is X only and doesn't have resource forks).
Posted by: Matt Craig | May 12, 2005 10:19 AM
Regarding the "Perforce makes me open a file before I can edit it" issue: All commercial version control systems work that way. If you are working on project with other people, the system needs to know when a file is "checked-out". That way, it can warn other users that they may need to resolve their changes if they try to edit the same file at the same time.
Perforce will also list your open files as part of a pending changelist, so that other users can see what changes your are working on.
Of course, if you're the only person working on a given project, you can do whatever you want.
Posted by: Joe | May 12, 2005 10:42 AM
"I find offline editing of PerForce files pretty easy - just change permissions, then, when back online, simply do "p4 edit" on the changed files (or p4 diff -x to find the changed files and update depot accordingly) and you're in business."
Thanks for the tip Matt. This still leaves me with a problem though. Under 10.4, my p4 client workspace won't be able to connect to the p4 server for the near future, so I can't run a p4 diff command to determine what I've changed. I guess I can copy my full tree over to a connected Mac and do a diff using FileMerge or CodeWarrior though.
As for p4v and Darwin, I assume it still doesn't work. The Mac p4v app still uses an Aqua version of Qt. They'd probably need a separate Darwin app that uses an X11 version of Qt I'd guess. They're pretty responsive to support e-mails - I'd drop them a line to see if they have plans.
Posted by: Brad Oliver | May 12, 2005 11:17 AM
Ah, yes Perforce... After having to suffer with VSS for 5 years we finally switched to Perforce for 99% of our company projects (ironically the 1% that hasn't migrated over is 50% of my work...). Any flaws I've noticed with Perforce are quickly outweighed by performance.
Brad, do you still have a 10.3.9 partition? If so, you could reboot into it and do work there. Or do you absolutely need to do work in 10.4.0?
Posted by: a2daj | May 12, 2005 03:30 PM
"Brad, do you still have a 10.3.9 partition? If so, you could reboot into it and do work there. Or do you absolutely need to do work in 10.4.0?"
I luckily kept my G5 running 10.3.9, so I didn't totally screw myself over. I also installed a 10.3.9 partition on this g4, but that has some gotchas. First, I have to use a fresh p4 workspace - I can't recycle my old one without royally screwing things up. Second, MovableType is running under 10.4, but isn't set up for 10.3.9, so I'd have protracted outages for that and ftp services.
But I need to debug KotOR's crash on 10.4.0 and nVidia cards. I also had to test netplay in Tiger Woods across my 2 Macs. I got into a rhythm where I'd do all my code changes on the G5, then just copy over the binary to my 10.4 box and run it straight, no debugger. This worked well for working on the net code in Tiger Woods, but it's not really feasible for KotOR. I may have to end up doing remote debugging from the G5 to the G4 to work on KotOR.
Posted by: Brad Oliver | May 12, 2005 03:52 PM
New version of the Cisco VPN client:
http://www.versiontracker.com/dyn/moreinfo/macosx/12696
Posted by: a2daj | May 14, 2005 02:30 PM
We've never really had a problem with 2 people editing the same file before. Although sometimes it's possible that 2 people might touch different parts of a file, we usually know what each other are doing because we see who's assigned bugs to themselves (so if I see someone assign an audio bug to themselves, then I know that I should talk with them before touching the audio code).
When a conflict occurs, then the second person to check their code in just does a merge.
Maybe this isn't the case in big organisations, but if 2 people are rewriting the same code at the same time then isn't that indicative of a deeper problem with communications?
Posted by: Calum Robinson | May 16, 2005 12:31 AM
"Maybe this isn't the case in big organisations, but if 2 people are rewriting the same code at the same time then isn't that indicative of a deeper problem with communications?"
Not necessarily. We have a porting library here that is shared with most of our game ports. It's very common for several ongoing ports in development to use this library, and for 2 ports to require a change in the same file at roughly the same time as we flesh things out more and more. For example, the Sims2 team might be implementing some wacky DX9 feature and the Tiger2k5 team will need to do DX9 work as well. We don't set up bug lists until the games hit beta, so during early development, things are a bit more free-form.
With p4, we can easily see if someone else is tinkering with a file and find out if they need something I'm going to work on or vice-versa. In this regard, p4's locking mechanism actually helps communications.
Posted by: Brad Oliver | May 16, 2005 10:42 AM
any word on the apache bug with mac os x 10.4? is there an apache bug number? i'm dying for a fix - any fix.
Posted by: john r. durand | May 18, 2005 09:49 AM
I liked subversion until I tried arch:
http://gnuarch.org/
bit of time to learn but it really pays off in elegance.
Michael
Posted by: Michael Hanna | June 21, 2005 03:21 AM
By the way, if $FILE is a whole file path, $FILE/rsrc is the path to the resource fork... Couldn't you use that for Perforce?
Posted by: Juan de Dios Santander Vela | June 22, 2005 01:53 AM
I've been using Perforce at my new position for a little over a month now. Before that, I used Subversion, and prior to that Oracle SCM, CVS and VSS. Before Subversion, Perforce would have been worth the hefty sticker price, but with Subversion offering atomic commits and a much simpler, more intuitive command model, I don't see any justification for companies to continue to hemorrage cash paying for Perforce. As for performance, it may just be my company network, but its performance is lousy compared to Subversion. P4Win is klunky, unintuitive, and goes "white-screen" during each sync, which is very slow. Other services on our network respond reasonably well, so I'm inclined to believe that the sluggishness is with the Perforce client. Subversion still has some maturing to do, but at a sticker price of $0, It beats Perforce hands-down. Subversion does have a UI, however. TortoiseSVN is a much better UI than P4Win, and it is integrates with Windows and Linux explorers.
Posted by: RPT | March 8, 2006 03:38 PM
"P4Win is klunky, unintuitive, and goes "white-screen" during each sync, which is very slow. Other services on our network respond reasonably well, so I'm inclined to believe that the sluggishness is with the Perforce client. Subversion still has some maturing to do, but at a sticker price of $0, It beats Perforce hands-down. Subversion does have a UI, however. TortoiseSVN is a much better UI than P4Win, and it is integrates with Windows and Linux explorers."
I believe P4Win is deprecated in favor of p4v, which (IMHO) is excellent. I can't say I've had a performance problem with p4 (I access ours remotely through a vpn) so I'm inclined to think that P4Win vs. p4v is part of your problem. Beyond that, my interest in comparing p4 and svn is strictly limited to the Mac. I couldn't care less about TortoiseSVN or P4Win.
Posted by: Brad Oliver | March 8, 2006 10:31 PM
Anyone have a performance problem through a hardware Cisco VPN firewall using Cisco VPN client 4.0.3(F) using Perforce server 2005.2 ?
-- Or any VPN performance issues that are of note?
Posted by: VinceM | April 3, 2006 05:47 PM
"Anyone have a performance problem through a hardware Cisco VPN firewall using Cisco VPN client 4.0.3(F) using Perforce server 2005.2 ?"
We don't use that exact setup (I use a later Cisco client with an earlier p4 server), but I'd say performance is pretty good. I used to access a p4 server directly (no vpn) but I don't recall if that was faster. I don't remember it being different.
Posted by: Brad Oliver | April 3, 2006 07:17 PM