зеркало из https://github.com/github/ruby.git
Make the range to export as changelog optional
* `from` is defaulted to the beginning of the branch inclusively, otherwise the given revision is excluded as the previous. * `to` is defaulted to the head.
This commit is contained in:
Родитель
d72bd190a8
Коммит
4c8f107898
|
@ -338,11 +338,7 @@ def package(vcs, rev, destdir, tmp = nil)
|
|||
def (clean = []).add(n) push(n); n end
|
||||
Dir.chdir(v) do
|
||||
unless File.exist?("ChangeLog")
|
||||
# get the beginning revision from matz's commit
|
||||
unless beginning = vcs.branch_beginning(url)
|
||||
abort "#{File.basename $0}: Cannot find revision from '#{last_ChangeLog}'"
|
||||
end
|
||||
vcs.export_changelog(url, beginning, revision, "ChangeLog")
|
||||
vcs.export_changelog(url, nil, revision, "ChangeLog")
|
||||
end
|
||||
|
||||
File.open(clean.add("cross.rb"), "w") do |f|
|
||||
|
|
10
tool/vcs.rb
10
tool/vcs.rb
|
@ -355,7 +355,7 @@ class VCS
|
|||
end
|
||||
|
||||
def export_changelog(url, from, to, path)
|
||||
range = [to, (from+1 if from)].compact.join(':')
|
||||
range = [to || 'HEAD', (from ? from+1 : branch_beginning(url))].compact.join(':')
|
||||
IO.popen({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'},
|
||||
%W"#{COMMAND} log -r#{range} #{url}") do |r|
|
||||
open(path, 'w') do |w|
|
||||
|
@ -481,7 +481,7 @@ class VCS
|
|||
end
|
||||
|
||||
def export_changelog(url, from, to, path)
|
||||
range = [from, to].map do |rev|
|
||||
from, to = [from, to].map do |rev|
|
||||
rev or next
|
||||
if Integer === rev
|
||||
rev = cmd_read({'LANG' => 'C', 'LC_ALL' => 'C'},
|
||||
|
@ -489,7 +489,11 @@ class VCS
|
|||
"--grep=^ *git-svn-id: .*@#{rev} ")
|
||||
end
|
||||
rev unless rev.empty?
|
||||
end.join('^..')
|
||||
end
|
||||
unless (from ||= branch_beginning(url))
|
||||
raise "cannot find the beginning revision of the branch"
|
||||
end
|
||||
range = [from, (to || 'HEAD')].join('^..')
|
||||
cmd_pipe({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'},
|
||||
%W"#{COMMAND} log --format=medium --no-notes --date=iso-local --topo-order #{range}", "rb") do |r|
|
||||
format_changelog(r, path)
|
||||
|
|
Загрузка…
Ссылка в новой задаче