Perforce blame

前端 未结 6 1841
闹比i
闹比i 2021-02-01 13:07

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!

6条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 13:31

    I use a small script for blaming

    #!/bin/bash
    
    FILE="$1"
    LINE="$2"
    
    p4 annotate -cq "${FILE}" | sed "${LINE}q;d" | cut -f1 -d: | xargs p4 describe -s | sed -e '/Affected files/,$d'
    

    you can hook it to some of the editors that will pass the file name and line.

    There's a little more complex version here.

提交回复
热议问题