English 中文(简体)
如何确定何时引入具体界线?
原标题:How to find when specific line was introduced?
  • 时间:2011-11-21 14:54:54
  •  标签:
  • perforce

在我的编码数据库中,我看上线和带;123>在具体档案中;我看一看何时采用。 我可以作第4号说明,以找到最后一次修改意见,但我确信,有办法回头介绍。 I m使用2009.2;如果是的话,则不是最新情况......

-Chris

这可能是一个坏的问题;我解决了我的问题,把树木拖回,直到基本上找到树木。

p4 annotage | grep

p4 annotage myFile#rev-1 furep

p4 annotage myFile#rev-1 furep

最佳回答

If you have p4v installed, you should use the time-lapse view. That will give you an accounting of all lines in the file, who introduced or changed those change, what changelist, etc. Timelaspse is an awesome tool and will give you what you need without needing to resort to grepping through old versions.

问题回答

垃圾处理

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"
"

    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




相关问题
Anything similar to git-svn for Perforce?

Is there a tool that allows me to gain the same functionality as git-svn for Perforce? I saw git-p4 on github but it looks like this imports source from a git repo to a Perforce repo. Does it go the ...

Converting Perforce repositories in to mercurial

I have a perforce repository on Windows machine say (p4). I can access this p4 repo using p4v client by providing IP:PortNumber details. Now I want to run "hg convert" command on this p4 repository ...

using perforce with team foundation server

Does Team Foundation Server 2008 or upcoming 2010 work with perforce as the SCM tool? I haven t been able to find any documentation on the web indicating whether or not this configuration is supported?...

Can a script be automated after a commit on Perforce?

We use Perforce at work, and routinely keep software projects in the repository. In general creators follow the normal Perforce flow, BUT we also have a class of users, who doesn t have any need to ...

Faster clean Perforce sync over VPN

I have to regularly do a clean Perforce sync to new hardware/virtual machines over the VPN. This can take hours as the project is quite large. Is there a way that I can simply copy an up-to-date tree ...

热门标签