Perforce is the industrial strength version-control system that the truly huge software makers (including many games studios) use. There are also non-standard uses of Perforce out there, including chip makers (NVIDIA), mover makers (Pixar), and athletic gear makers (Adidas). By non-standard I mean not source-code as you know it. I love it because it doesn’t break with extremely large repositories or large binary objects, has fine-grained permissions at directory and file level, allows me to easily subset during a checkout. Note git’s sparse checkout is not sparse clone.

Perforce is formally announcing a bunch of products and services today - take a look at their press release and follow the links from there. The one I want to concentrate on is the DVCS capability that’s interoperable with the traditional server (and is an extension to their existing client technology). I want to concentrate on that one because you can play with it today, and has been in beta for a month so far. Amongst the announcement is product renames, and I’ll adopt their new (Helix + other) names after today :)

I’ve made a few scripts for Mac people. In there you can download/install binaries for the perforce client and server (Mac). That script is get_binaries.sh, and the README of the above project talks you through it. I’ll refer to the other scripts in there going forward.

Copying Subversion Revisions into Perforce DVCS

This is a decent experiment for the new DVCS side of Perforce.

Firstly create a folder to work in - say /Users/you/ImmaGunnaPlayWithPerforceHere/ and cd into in that.

Next checkout the trunk of your favorite Subversion repo to that directory (note the trailing dot): svn co https://mysvnepo/foo/trunk.

Then do a p4 init -C0 in the same folder.

Now run the conversion script - path/to/convert_svn_to_p4.sh - and kiss goodbye to some minutes or hours. This is derived from an earlier subversion to perforce script that I talked about. Note: it is going make a folder and some work files in the parent directory all prefixed with svn_to_p4. You can delete them afterwards.

The script takes twice as long as git-svn-clone to run. That’s not an important benchmark, as it is not going to be problematic if you’re about to switch source-control systems from Subversion to Perforce. What I mean is that you would convert the first million commits a day before you cut over, then the last few thousand in the minutes before formal change moment.

What this saves you with is all the commits to trunk, in the local p4 DVCS repo. Do p4 changes to see them.

Incidentally, the Perforce people have their own svn-to-p4 migration technology, but I’d managed to mess up Java on my Mac, and couldn’t run it, and it was fun to work on my bash skills some more.

Stability of the DVCS side of Perforce

I’m enjoying playing with it, and it seems quite stable. At the time of writing, v15.1 is what will be downloaded from Perforce’s FTP server. However, it’s a beta without a beta suffix. The first 15.1 I downloaded was from January, but it is now sporting a Feb 19th build date.

Git and Perforce command comparison

  1. p4 init is the equivalent of git init
  2. p4 add xxx is the equivalent of git add xxx
  3. p4 delete xxx is the equivalent of git rm xxx
  4. p4 edit xxx (like perforce) precedes the editing of a file and has no equiv in Git.

However you can ignore 2 through 4 above if you’re willing to trust p4 reconcile to put everything new (including deletes) in a change list. And you should trust reconcile, I’ve been testing the hell out of it.

  1. p4 status is broadly the equivalent of git status
  2. p4 submit -d "message" is the equivalent of git commit -m "message"
  3. p4 push is the equivalent of git push
  4. p4 fetch is the equivalent of git pull

Type p4 help dvcs to see more. As of writing there’s no online documentation for the dvcs side of P4 - it is in beta really.

Smarter bash commands for Perforce

Alan Teague - Chief Architect at Perforce, and lead for the DVCS side of Perforce - has his own bash magic for those of use that live on the command line. It’s a “use at own risk” thing, though.

Quick start with the traditional Perforce

You can also run though a quick, scripted, setup for both the tradition p4d server and a p4 client workspace, though that isn’t necessary for this article (you just need to install the binaries). The step by step of that are on the README for the fast_perforce_setup project on on Github.



Published

March 3rd, 2015
Reads:

Categories