Perforce 如何确定何时引入特定行?
在我的代码库中;我看到行在一个特定的文件中;我想看看它是什么时候推出的。我可以通过“p4注释”查找上次修改的时间;但我相信有一种方法可以让我们回到介绍的话题。。我用的是2009.2;不是最新的,如果这很重要的话 -克里斯 编辑 这可能是个糟糕的问题;我解决了我的问题,我走回树,直到找到它添加的位置,基本上 p4注释| grep p4注释myFile#rev-1 | grepPerforce 如何确定何时引入特定行?,perforce,Perforce,在我的代码库中;我看到行在一个特定的文件中;我想看看它是什么时候推出的。我可以通过“p4注释”查找上次修改的时间;但我相信有一种方法可以让我们回到介绍的话题。。我用的是2009.2;不是最新的,如果这很重要的话 -克里斯 编辑 这可能是个糟糕的问题;我解决了我的问题,我走回树,直到找到它添加的位置,基本上 p4注释| grep p4注释myFile#rev-1 | grep p4注释myFile#rev-1 | grep如果安装了p4v,则应使用延时视图。这将为您提供文件中所有行的记录,谁引入或
p4注释myFile#rev-1 | grep如果安装了p4v,则应使用延时视图。这将为您提供文件中所有行的记录,谁引入或更改了这些更改,更改列表是什么,等等。Timelaspse是一个非常棒的工具,它将为您提供所需的内容,而无需通过浏览旧版本。ruby中的解决方案
file = "/path/to/your/file"
period = "#8,10" # could be @2012/10/01,@now
$all_authors = []
def find_changed_lines file, period
puts "File: #{file}#{period}"
ls = `p4 annotate -a #{file}#{period}`.split"\n"
a = []; b = []; prevrev = ""; linen = 0; authors = []
# find [first, last] aka [min, max] file revisions for given period
ls.each{ |l| l[ /^([0-9]+)-([ 0-9]+):/ ]; a<<$1.to_i if $1; b<<$2.to_i if $2; }
first = a.min.to_s; last = b.max.to_s
# find changed lines
ls.each{ |l|
l[ /^([0-9]+)-([ 0-9]+):/ ]
# find line number
linen +=1 if $2==last
# reject lines if #not changed line or #itermediate change
unless ($1==first and $2==last) or ($1!=first and $2!=last)
# find rev#
rev = $2==last ? $1 : ($2.to_i+1).to_s
# print cl desc info based on rev# unless printed for prev line
if prevrev != rev
cldesc = `p4 filelog -m 1 #{file}##{rev} | head -2 | tail -1`
puts cldesc
# collect change author
authors << cldesc[/by (.*)@/, 1]
prevrev = rev
end
# print changed line with line number
puts l.sub(/^.*:/, "#{linen}:" )
end
}
puts "Change authors: #{authors.uniq!.join(', ')}"
$all_authors += authors
end
find_changed_lines file, period
file=“/path/to/your/file”
period=“#8,10”#可能是@2012/10/01,@now
$all_作者=[]
def find_changed_行文件,句号
放置“文件:{File}{period}”
ls=`p4注释-a#{file}{period}`.split“\n”
a=[];b=[];prevrev=“”;亚麻布=0;作者=[]
#查找给定期间的[first,last]aka[min,max]文件修订
ls.each{l | l[/^([0-9]+)-([0-9]+):/])aUm,修改一行的更改就是引入该行的更改。您必须使用启发式方法来确定“嗯,这行是对另一行的编辑,所以现在我将查找修改另一行的更改。”或者您正在寻求帮助开发该启发式方法吗?