2008-09-11 75 views
46

在命令行中是否有相當於svn對Perforce的責任? p4 annotate不顯示用戶名 - 只有變更集編號(沒有祖先歷史!)。Perforce責怪

我現在必須通過祖先跟蹤代碼,並與文件日誌進行比較,而且必須有一個更簡單的方法 - 可能是F/OSS實用程序?

+2

這是一個重要的功能。 Git和Subversion可以做到這一點。向Perforce開發人員提出了一項功能請求http://www.p4ideax.com/ideas/11922/add-a-command-p4-blame-similar-to-git-blame – 2013-01-07 15:12:55

回答

10

嘗試採取看看一對夫婦的,我認爲可以讓你你最需要什麼樣的工具:

1)p4pr由Bob Sidebotham和喬納森Kamens Perl腳本。

2)Emacs Perforce接口有一個命令'p4-print-with-rev-history'(綁定到`C-x p V')。

54

我並不太熟悉blame命令,但我認爲您正在尋找誰更改了特定的代碼行。最簡單的方法是使用Perforce的p4win和p4v提供的「時間推移視圖」。

此工具使用註釋和其他一些命令爲您提供隨時間推移的代碼行視圖。你可以看到誰修改了什麼代碼,當它被插入或從代碼行中刪除時,等等。

雖然它不是命令行。我在幫助中簡單地檢查了一下,似乎沒有辦法直接從p4win或p4v調用啓動延時視圖。有可能是雖然...我將進一步檢查...

編輯:我支持檢查,您可以通過P4V啓動延時觀點如下:

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

HTH。

+0

我同意TimeLapse視圖在準確顯示誰改變了哪一行。一直使用它。 – 2008-09-11 21:13:39

+0

如何在p4win中啓動時間延遲視圖? – cdleary 2008-09-11 21:35:35

+2

即使使用P4Win,也必須安裝P4V才能訪問延時功能。一旦你這樣做了,「Time-lapse View ...」將出現在文件上下文菜單中。 – raven 2008-09-22 16:13:00

1

@ alanw123:P4PR是接近我正在尋找,但它不跨分支的界限:

last if $type eq 'branch'; 

這是我當我試圖寫我自己的工具的主要問題 - 你不能(輕易地)告訴線路如何映射回分支的文件。

3

從P4V客戶端,就可以得到「時間推移視圖」上下文菜單上的所有文件一樣,變更列表等

的時間間隔視圖具有像單一版本相當多的選項,多視圖顯示文件修訂以分析什麼發生了變化,什麼時候和由誰發生。

1

p4 annotate命令實際上可以跟隨合併/集成,並與-I-i命令在命令行上分支(但不能同時做兩:():

-I 
Follow integrations into the file. If a line was introduced into the file by a merge, the source of the merge is indicated as the changelist that introduced the line. If that source was itself the result of an integration, that source will be used instead, and so on. 
The use of the -I option implies the -c option. The -I option cannot be combined with -i. 
-i 
Follow file history across branches. If a file was created by branching, Perforce includes revisions up to the branch point. 
The use of the -i option implies the -c option. The -i option cannot be combined with -I. 
4

我用一個小腳本指責

#!/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' 

,您可以在勾一些將通過文件名和行的編輯。

還有一點更復雜的版本here