ruby19-pure-git-build-support.diff

hongli (Hongli Lai), 12/31/2008 11:54 pm

Download (970 Bytes)

b/tool/file2lastrev.rb
9 9
def detect_vcs(path)
10 10
  path = SRCDIR
11 11
  return :svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.svn")
12
  return :git_svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git/svn")
12 13
  return :git, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git")
13 14
  raise VCSNotFoundError, "does not seem to be under a vcs"
14 15
end
......
20 21
  info = case vcs
21 22
  when :svn
22 23
    `cd "#{SRCDIR}" && svn info "#{path}"`
23
  when :git
24
  when :git_svn
24 25
    `cd "#{SRCDIR}" && git svn info "#{path}"`
26
  when :git
27
    git_log = `cd "#{SRCDIR}" && git log HEAD~1..HEAD "#{path}"`
28
    git_log =~ /git-svn-id: .*?@(\d+)/
29
    "Revision: #{$1}\nLast Changed Rev: #{$1}\n"
25 30
  end
26 31

  
27 32
  if /^Revision: (\d+)/ =~ info