23 messages in com.perforce.perforce-user[p4] Labels or branches?
FromSent OnAttachments
mj...@panasas.com04 Jun 2001 21:20 
Mike Castle04 Jun 2001 22:04 
Chuck Karish05 Jun 2001 00:54 
Robert Cowham05 Jun 2001 01:43 
Matthew Rice05 Jun 2001 04:39 
Stephen Vance05 Jun 2001 07:20 
Keith Johnson05 Jun 2001 07:37 
Dave Lewis05 Jun 2001 08:09 
Jeff A. Bowles05 Jun 2001 08:14 
Chuck Karish05 Jun 2001 16:35 
Maurice Meyer05 Jun 2001 17:17 
Mike Castle06 Jun 2001 10:32 
Robert Cowham06 Jun 2001 10:55 
Matthew Rice06 Jun 2001 11:37 
Jeff A. Bowles06 Jun 2001 12:45 
Stephen Vance06 Jun 2001 20:09 
Stephen Vance07 Jun 2001 08:28 
Chuck Karish07 Jun 2001 09:33 
Ganesh Kondal07 Jun 2001 15:52 
Stephen Vance07 Jun 2001 18:08 
Chuck Karish07 Jun 2001 21:54 
Paul Goffin08 Jun 2001 00:35 
Stephen Vance08 Jun 2001 07:55 
Subject:[p4] Labels or branches?
From:Jeff A. Bowles (ja@pobox.com)
Date:06/05/2001 08:14:33 AM
List:com.perforce.perforce-user

They're roughly the same overhead in the database, but in different tables. Also, a label is slightly more cumbersome in that there's no history for updates of a label; a branch has to have explicit operations (integrate/resolve) to push content to/from it.

My question is, are these the only choices to track an overnight build? I would argue that there are other choices.

Probably the most attractive, low-cost way to track the contents of the overnight build is to do this: 1. Acknowledge that you're building the most recent revision of the files in some tree in your repository, as of 2 AM (or whatever) each night. (If this isn't a valid statement, then step #2 will use some other method to track the contents.) 2. The command "p4 changes -m1 -s submitted //depot/main/..." (or whatever the codeline name is) will give you the change number of the most recently submitted change. (It's a complete line, actually, so pipe this to "cut -d' ' -f2 " first.) YOUR BUILD SCRIPT SHOULD GET THIS CHANGE NUMBER AS ITS FIRST STEP. If it's a shell script, for example, the first lines might be: TopChangeNumber=`p4 changes -m1 -s submitted //depot/main/... | cut -f2 -d' ' ` Or perhaps, even: CodeLine=main TopChangeNumber=`p4 changes -m1 -s submitted //depot/$CodeLine/... | cut -f2 -d' ' ` 3. Put this pair: ($CodeLine, $TopChangeNumber) into a version.h file that all source files include. Have your programs support "programname -version" to print it out. 4. When you retrieve the files to do the build, use the commands: a. "p4 sync #none" (empty the workspace of Perforce-managed files) b. del /s (or rm -rf) the workspace (empty of all other files) c. "p4 sync //depot/$CodeLine/...@$TopChangeNumber" (get the files) d. Make your version.h file that refers to $CodeLine and $TopChangeNumber 5. Do the compiles.

This has almost no data storage overhead, since that changenumber is derived from data that's live at the time of the build.

And it's absolutely immutable.

-Jeff Bowles Perforce Consulting Partner

ps. Thanks to James Strickland (Perforce) for emphasizing, in his many examples, that you really HAVE to use 'p4 changes -s submitted' to avoid picking up change numbers of pending/not-submitted changes that would blow this into little bits.

At 12:20 AM 6/5/2001 -0400, you wrote:

I'm looking at integrating our automated nightly build system with Perforce, and I'd like to set up a system where the tree for each nightly build is assigned a label (foo-nightly-yyyymmdd) or branch (//depot/foo/nightly/yyyymmdd), so the exact revision of each file in that nightly build is marked, and can be retrieved easily.

I'm pretty familiar with Perforce, but I don't have a good handle for which one of these techniques (label or branch) will have lower overhead. I realize that the branch won't have to store any extra file data, since the files aren't being modified on the branch and Perforce branches are copy-on-write. Therefore, both the branch and the label appear to only involve metadata bloat. How much metadata is involved in keeping a branch record around versus a label? Are there any advantages of doing a branch vs. a label in terms of being able to do diffs between the nightly checkpoint tree and the current tree, or between two nightly checkpoints?

Thanks for any pointers that the list can provide...

mju at panasas.com http://www.panasas.com/