Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perforce blame

Is there an equivalent of svn's blame for Perforce on the command line? p4 annotate doesn't display usernames -- only changeset numbers (without ancestor history!).

I currently have to track code back through ancestors and compare against the filelog, and there just has to be an easier way -- maybe a F/OSS utility?

like image 660
cdleary Avatar asked Sep 11 '08 19:09

cdleary


People also ask

What is git blame used for?

Summary. The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

What does p4 annotate do?

The p4 annotate command displays the revision number for each line of a revision (or range of revisions) of a file (or files). Using the -u option displays the name of the user who modified the change and the date when the modification occurred.


1 Answers

I'm not overly familiar with the blame command, but I assume that you are looking for who changes a particular line of code. The easiest way is to use Perforce's 'time lapse view' available from both p4win and p4v.

This tool uses annotate and some other commands to give you a view of the code line over time. You can see who modified what code, when it was inserted or removed from the codeline, etc.

It's not command line though. I checked briefly in the help and there doesnt' seem to be a way to launch the time lapse view directly from a p4win or p4v invocation. There might be though...I'll be checking further...

Edit: I checked with support, and you can launch the timelapse view through p4v as follows:

p4v.exe -cmd "annotate //<path/to/file>" 

HTH.

like image 170
Mark Avatar answered Sep 18 '22 12:09

Mark