Private Branches take setup and practice.
http://farrago.sourceforge.net/privateBranch.html
is a good page on branching in P4. It does not help towards automating the use of a Private Branch, but covers the topic well.
http://kb.perforce.com/UserTasks/CodelinesAndBranching/BranchingCod..gin...
is the Perforce article on Branching. It doesn't discuss using branches for other activities such as private branching.
http://geekswithblogs.net/EltonStoneman/archive/2008/04/04/scripting-bra...
uses a tool from codeplex one has to download. Why? Anything a P4 client can do can be scripted in lowly batch files. Ant is better, especially with the exec target in 1.7.0. Yet, Perforce gives out API's for Perl, Python and C++. But, it does show a good plan for those who may want a starting point.
Basically, to branch code one needs to set up Perforce first.
1) Decide what kind of branch you want:
a) Private/task branch -- Choose the files you want to branch. This will save time. Even if your first guess is wrong.
b) Release/staging branch -- You will pull everything to re-create the BUILD.
2) Create a new branch. Name it BR__
3) Make sure the user has access to both sides of the branch.
4) Create a "test" client for the new branch.
5) Make sure you can BUILD the same in both branches.
6) Create a "master" template client.
7) Create your copy of the client.
8) Finally, you can back to work.
Good luck integrating your changes back!
