Perforce: Is there a straightforward way to track a code change to the original submission?

change-tracking, integration, perforce, revision-history, version-control

Solution

You can use `p4 annotate -i` to follow history if the file was branched and `p4 annotate -I` to follow history from integrations to the file.

Problem

I have a source file `//code/main/Foo.cpp` whose line N was changed. After a combination of `p4 annotate` and `p4 filelog`, I found the change came in from a branch. (This is my understanding of e.g., `git blame`.) Drilling into that branch I again used a combination of `p4 annotate` and `p4 filelog` to find the line change came from an integration from yet another branch. Drilling into that branch I again used a combination of `p4 annotate` and `p4 filelog` to find the actual changelist that contained the original submission that eventually led to changing line N in `//code/main/Foo.cpp`. Is there no easier way to do this? I would like to point to a line in a file and say, "Where and when did that line first appear as currently written in the depot?" What I want, then, is a deep `git blame` that traces a change all the way back to its origination.

Original source