Perforce is a popular source code management tool that has been around since 1995. I have never had an opportunity to work with Perforce, but I have always been keenly aware that the Perforce users are among the most loyal and many are devout in their support and love of this product. For this review, I took a look at the features and usage of Perforce myself and was definitely impressed with what I saw. Perforce is a relatively inexpensive product, but quite rich in features and the vendor, Perforce Software, Inc., is obviously very responsive to their customer base. Read on if you would like to know more about this product and whether or not it will fit your SCM needs.
Basic Usage In assessing this product, I switched back and forth between using the p4 command line and the P4V gui interfaces.
The terminology for Perforce is a little unusual, although the usage model was very familiar. I found that the P4V gui made it much easier to understand how to use the product effectively, and pretty soon, I was enjoying Perforce's power and flexibility. Perforce is based upon a client/server model with one or more centralized depots which communicate using the TCP/IP protocol (which runs at fast FTP speeds). There is also the familiar "client" workspace (or what I usually call a sandbox). When I started using a new workspace, I issued a "sync" command to refresh the workspace bringing in any changes that have been made by others.
|
> p4 sync
//depot/readme.txt#1 - added as c:\_cmCrossroads\_Perforce\readme.txt
|
Now that I had a refreshed workspace that was completely up to date I added a few files and submitted the changes back to the depot.
|
> p4 add readme2.txt
//depot/readme3.txt#1 - opened for add
> p4 add readme2.txt
//depot/readme3.txt#1 - opened for add
> p4 submit
Change 4 created with 2 open file(s).
Submitting change 4.
Locking 2 files ...
add //depot/readme2.txt#1
add //depot/readme3.txt#1
Change 4 submitted.
|
Reverting back to a previous version If you have made changes to a file in your client workspace and then want to undo those changes - the revert command is what you are looking for. Perforce has a number of features that allow you to return to a previous revision of the repository and start over - which is very handy when you are trying to fix a bug in your code and you have to try several different approaches. Understanding Client Workspace Views One of the key concepts that I needed to understand was the mechanism for Perforce to map depot files to the client workspace. This is known as a workspace view. You can create mappings so that your workspace view is customized to your needs. This feature provides considerable flexibility and power by allowing the user to configure different views to show different slices of one or more depots..
Changelists support atomic commits Perforce supports atomic commits - which means that all of your changes get checked in on a submit or else they are rolled back. The Changelist is a Revision number that persists across the entire repository. Changelists are not available in every major CM tool and they are quite handy when you want to be able to roll back to a previous version of the entire repository.

Resolving changes submitted by more than one user Perforce normally uses the familiar "unreserved-checkout" model which means that more than one user can submit changes on the same file at the same time. Perforce provides a mechanism to notice the conflict and then prompts the (second) user to resolve the conflict before the changes are then resubmitted. (Users can choose to employ exclusive locks instead if so desired.) Exclusive locks also provide a mechanism to prevent merges from occurring. Flexibility and power are two common themes that I found when evaluating Perforce for this review.
Keeping your users happy I have long been aware that the Perforce user community is very active and very vocal in their support and use of this product. For this review, I asked a number of Perforce users to share the reasons why they liked Perforce. In my view, Perforce may have the most loyal user base of any popular CM tool. The feedback that I received could be broken down into several categories. The first was "ease of use" in that Perforce was very easy to learn and master the basic usage. The second was that the advanced features were powerful and flexible. This was often followed by the observation that the overall architecture was robust and reliable. I find that expert users are always delighted to help newbie Perforce users master the power of advanced branching (one of Perforce's other areas of strength) and effective usage in both small and largescale enterprise wide environments. Judging from the customer loyalty, Perforce is definately doing something right!
Martin Fowler on Perforce
|
Martin Fowler, in an oft quoted comment on his website said, "So as a simple basis make sure you get a decent source code management system. ... The only tool I've consistently heard people say is worth paying for is Perforce." http://martinfowler.com/articles/continuousIntegration.html
|
Branching and Merging Perforce allows you to create a copy of a baseline that can be used as a variant in the code - known as a branch. This is done using the "integrate" command - which essentially copies the files to a branch which you can then modify and finally submit back to the depot. As noted in the Perforce documentation, "To create a codeline or development branch, decide which files belong in the branch (the source files), and integrate those files into the new codeline to create the target files". You can use the revert command to undo an integrate if you have not submitted the changes.
|
> p4 integrate //depot/scripts/... //depot/branch1/scripts/...
//depot/branch1/scripts/myProgram.ps1#1 - branch/sync from //depot/scripts/myProgram.ps1#1
//depot/branch1/scripts/ProductionPromotion.ps1#1 - branch/sync from //depot/scripts/ProductionPromotion.ps1#1
> p4 submit
Change 5 created with 2 open file(s).
Submitting change 5.
Locking 2 files ...
branch //depot/branch1/scripts/myProgram.ps1#1
branch //depot/branch1/scripts/ProductionPromotion.ps1#1
Change 5 submitted.
|
Perforce has some pretty complicated branching and merging features. The first time that I heard that Perforce makes "lazy copies" I was a bit puzzled until the Perforce gurus explained to me that Perforce makes internal copies of files without duplicating file content in the depot. "Lazy copies minimize the consumption of disk space by storing references to the original file instead of copies of the file." The internal "lazy copies" are made in the metadata. This is a key feature and different than many other SCM tools. Their support folks also explained to me that Perforce's Inter-File Branching™ reduces the risks typically associated with branching and merging code. With this feature you only merge once. Perforce tracks what was merged, when and by whom. Intuitive tools and intelligent branching make merging straightforward and painless. Inter-File Branching™ is quick and efficient on any size of project.
The results of the branching are, of course, visible from the gui.
P4 diff, p4 diff2 and P4Merge Perforce gives you powerful tools to compare files, complete codelines via a command line or a user friendly gui. This allows you to effectively merge changes back to the mainline if necessary. The P4V gui includes diff capability, but the P4Merge also includes support for merging files.
Revision Graph: The revision graph feature displays a tree-style graph representing the branching history of a specified file, including all file branch points, edits, and merges.
Time Lapse View: Time-lapse View provides a graphical way to view the complete change history of individual text files stored in the Perforce repository. In a single window, developers can instantly visualize changes to code over any user-defined time period using familiar graphical elements.
New Features in Perforce 2008.2 There are a number of new and enhanced features in version 2008.2 of Perforce. These include the ability to graphically preview the effects of integrating changes between branches, as well as a new rollback feature that allows previously submitted work (e.g. file revisions, groups of files, and integrations) to be easily backed out. There are also a number of admin features including automatic discovery of Perforce Servers and a new dashboard that makes it easier for admins to monitor available storage, inactive user status and the processing time of specific Perforce operations.
Administrative Dashboard

Extending Perforce through APIs Perforce can be extended through Perl or Python APIs and is supported by all of the major continuous integration servers. Perforce also has a Proxy feature that brings files to remote users on demand and caches them locally for other users at the same location. Local caching guarantees quick response times for remote users while maintaining real-time access to project activity and status information. More information on this feature is available at this link . This feature helps make Perforce scalable as is a critical feature for large organizations. Platforms supported Perforce runs on Windows, Mac OS X, Unix (e.g. Solaris, FreeBSD), Linux, and Windows. There is a pwerful command line interface as well as a crossplatform GUI (called P4V) as well as a variety of integrations that allow you to use Perforce from within your favorite IDE. The IDEs supported include Eclipse, Visual Studio, WebSphere and RAD7. The other integrations with build tools (e.g. Ant), defect tracking, ALM tools (e.g. Kovair), Code Review and graphical tools may be found at this link.
If you are looking for a solid source code management tool, that will likely be very popular with your users, then Perforce should be on your list of products to evaluate and consider for your organization's use. Your turn! I always love hearing from other technology professionals on how they approach their own CM and RM best practices. Please drop me a line and share what works and what doesn't in your own environment!
Bob Aiello is the Editor-in-Chief for CM Crossroads and an independent consultant specializing in Software Process Improvement including Software Configuration and Release Management. Mr. Aiello has over 25 years experience as a technical manager in several top NYC Financial Services firms where he had had company-wide responsibility for CM, often providing hands-on technical support for enterprise Source Code Management tools, SOX/Cobit compliance, build engineering, continuous integration and automated application deployment. Bob is a long standing member of the Steering Committee of the NYC Software Process Improvement Network (CitySPIN), where he serves as the chair of the CM SIG. Mr. Aiello holds a Masters in Industrial Psychology from NYU and a B.S. in Computer Science and Math from Hofstra University. You may contact Mr. Aiello at raiello@acm.org or link with him at http://www.linkedin.com/in/bobaiello .
Trackback(0)
Comments 
Write comment
 |