Chapter 8. Basic Codeline Management
This chapter introduces conventions, policies, and techniques for managing codelines in a Perforce system. It also describes common pitfalls and missteps of codeline management that can easily be avoided.
Organizing Your Depot
You know by now that the Perforce depot is a hierarchical structure of directories and files, and that you are at liberty to organize it as you please. The question is, what is the best way to organize it? There is no one right answer, of course, but some factors and recommendations should be taken into consideration as you decide what goes where.
Filespecs as containers
Interestingly, Perforce doesn’t know about containers like bodies of code, codelines, and modules. However, in Perforce we can containerize, and we do, with filespecs.[*] Any set of files that can be described with a single filespec can be treated as a container with a life and a history of its own. Filespec-defined containers can be used in activities like navigating a depot tree, setting up a workspace, making a branch, and configuring a release. This, in turn, lets us treat these containers as true SCM objects—that is, as objects that can be versioned, compared, branched, merged, labeled, and restored.
For example, //Ace/REL1/... is the filespec that refers to Ace’s Release 1 codeline. You can use this filespec to do things like display its recent history:
p4 changes -m3 //Ace/REL1/...
Change 9634 ... bob 'Fix installer ...' Change 9632 ... bob 'Rebuild ...
Get Practical Perforce now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.