views:

45

answers:

1

Hi all,

i'm preparing a seminary about p4 and i'm trying to find the best way to use the "Task per branch" methodology, now i'm using the following steps: (all by CLI)

  • Set my client to the root depot in order to create the new branches. View: //depot/... //myMachine/...

  • p4 -c myClient integ -v //depot/MAIN/... //depot/myBranchX/...

  • p4 -c myClient submit -d "Branching"

  • Change again my client aiming to the new branch. View: //depot/myBranchX/... //myMachine/...

  • p4 -c myClient sync

i'm wondering if there's a fastest/better way to do it. Specially working with huge repositories and branches.

Thanks! M.

+2  A: 

So... you want to create a branch for each task/bug and you want the newly created branch to mapped to client/workspace as if it was the trunk. And you want to be able to this via the command line or by running a scrip. Correct?

OK.

What is there a reason you want to adopt this workflow? Are you working on critical software, i.e., life/death scenario where every task is isolated and needs to be thoroughly vetted before integrating into the main line.

Unless you have a situation like above I would recommend against this workflow. Creating a branch for every task, especially in a large repository will eventually bring your Perforce server to a crawl. An similar situation was posted recently on the Perforce Blog as an Anti-Pattern (what not to do). Perforce Anti-Patterns Part 2: Overuse of branching.

Think about it.

If you still want to proceed, then you can achieve what you want by writing a shell script (DOS, Bash, Python**) that groups the above commands together taking a few arguments for the task/branch name etc. Comment if you need further help in doing this.

** preferred, then compile the script using py2exe as an executable for distribution.

Dennis Roche