Search code examples
perforcechangelist

Getting the change number of the first revision of a file in Perforce?


Is there a way to retrieve the change of the first revision of a file in Perforce? Sometimes I want to read the job description of the change that introduced a file, in order to learn what the file does, as well as to find related CRs for more information. I'm looking for something in the command line, e.g.

p4 <something> <file>

Solution

  • Ah, never mind, I found the subcommand I needed, p4 fstat, just after posting the question.

    $ p4 fstat cama_Preempt#1
    ... depotFile //depot/MMA/products/CAMA/main/src/testScripts/cama_Preempt
    ... clientFile /ext1/acheong/CAMA/main/src/testScripts/cama_Preempt
    ... isMapped
    ... headAction add
    ... headType text
    ... headTime 1174070670
    ... headRev 1
    ... headChange 168703
    ... headModTime 1174070479
    ... haveRev 1
    

    The headChange field shows the change number.