diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-04-28 12:16:40 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-04-28 13:46:16 +0900 |
commit | 4c8f1078985613ea1015fe1a1cdbe9944528cb35 (patch) | |
tree | a64dc57d2c96856260ccb1ae85e78e8ab3a326b8 /tool | |
parent | d72bd190a80e6b8258ca923b606175754a210b6d (diff) | |
download | ruby-4c8f1078985613ea1015fe1a1cdbe9944528cb35.tar.gz |
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.
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/make-snapshot | 6 | ||||
-rw-r--r-- | tool/vcs.rb | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot index 6161335eeb..d81a28c091 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -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| diff --git a/tool/vcs.rb b/tool/vcs.rb index 7dadada494..d7f92bd7c2 100644 --- a/tool/vcs.rb +++ b/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) |