perforcechangelist

How to find the previous submitted change lists?


Is there a Perforce command to find the immediate previous submitted change list for a given submitted CL on a particular branch .

For example on a branch //depot/temp/1.0/... i have submitted CL11, CL22, CL36, CL49 etc .. so for a given submitted CL (CL36) , How can i find out its immediate previous CL i.e CL22?

I tried running p4 changes //depot/temp/1.0/... so that it gives me all the change list and then i am parsing them to get the required CL

But i am looking for direct p4 command to achieve this


Solution

  • Adding on to pitseeker's answer, here's how to do the last two without Unix commands:

    The following commands only list the change before change 36:

    p4 changes -m1 "//depot/temp/1.0/...@<36"
    p4 changes -m1 //depot/temp/1.0/...@35
    

    (note that you need to use quotes with the @< syntax or your shell will see it as a redirect. I personally prefer the "subtract 1" approach when doing things like this with change numbers -- one huge benefit they have over labels or commit hashes IMO is that you can reason about them like numbers.)

    The following command only lists the change number before change 36:

    p4 -Ztag -F %change% changes -m1 //depot/temp/1.0/...@35