1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added VCS::SVN#branch_beginning

This commit is contained in:
Nobuyoshi Nakada 2019-04-28 12:11:59 +09:00
parent b766970527
commit d72bd190a8
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 11 additions and 2 deletions

View file

@ -339,7 +339,7 @@ def package(vcs, rev, destdir, tmp = nil)
Dir.chdir(v) do
unless File.exist?("ChangeLog")
# get the beginning revision from matz's commit
unless beginning = vcs.branch_beginning
unless beginning = vcs.branch_beginning(url)
abort "#{File.basename $0}: Cannot find revision from '#{last_ChangeLog}'"
end
vcs.export_changelog(url, beginning, revision, "ChangeLog")

View file

@ -345,6 +345,15 @@ class VCS
FileUtils.rm_rf(dir+"/.svn")
end
def branch_beginning(url)
# `--limit` of svn-log is useless in this case, because it is
# applied before `--search`.
rev = IO.pread(%W[ #{COMMAND} log --xml
--search=matz --search-and=has\ started
-- #{url}/version.h])[/<logentry\s+revision="(\d+)"/m, 1]
rev.to_i if rev
end
def export_changelog(url, from, to, path)
range = [to, (from+1 if from)].compact.join(':')
IO.popen({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'},
@ -465,7 +474,7 @@ class VCS
FileUtils.rm_rf(Dir.glob("#{dir}/.git*"))
end
def branch_beginning
def branch_beginning(url)
cmd_read(%W[ #{COMMAND} log -n1 --format=format:%H
--author=matz --committer=matz --grep=has\ started
-- version.h include/ruby/version.h])