Alex Rivera | Logout

Perforce: Find source changelist for a branch

Asked 2010-11-03T15:04:15.640
13

Short version:

After branching in P4, how can I find out the "source" changelist of the branch?

Long version:

Let's say I have a main branch of my project at

//project/main/...

The latest changelist submitted here is @123, when I decide to create a branch for release 1.0 in

//project/1.0/...

From P4V, a new changelist is created (say @130), resolved and submitted.

From the CLI, it would look something like this:

p4 integrate -c 123 -o //project/main/... //project/1.0/...
p4 submit

Later, I look at the changelists under //project/1.0, and see the @130 changelist containing a lot of branched files. How can I find out the changelist no. that this was originally branched from (that is, @123) ?

Edit
Report

1 Answer

1

I don't know of any simple command that performs what you would like to do. If you are willing to script a little bit and the command doesn't have to execute fast you could perhaps try to script something like the following for all branched files:

  1. Find the source file/revision for a target file.

    p4 filelog //project/1.1/foo.bar#1
    //project/1.1/foo.bar
    ... #1 change 6416 branch on 2009/07/10 by foo@bar (text) 'Release 1.1'
    ... ... branch from //project/main/foo.bar#1,#2

  2. Get the change list at which the source file/revision was submitted.

    p4 fstat //project/main/foo.bar#2
    ... depotFile //project/main/foo.bar
    ... headAction edit
    ... headType text
    ... headTime 1201771167
    ... headRev 2
    ... headChange 5353
    ... headModTime 1201770971

  3. Repeat for all files in branch and select the highest change no (headChange above), which should be the latest change submitted to the parent before branching for that specific file. You could get a complete listing of all branched files using e.g. "p4 files //project/1.0/...#1".

(or perhaps take the easy way out and ask Perforce support)

answered 2010-11-04T13:40:20.263

Your Answer