summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-28 12:16:40 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-28 13:46:16 +0900
commit4c8f1078985613ea1015fe1a1cdbe9944528cb35 (patch)
treea64dc57d2c96856260ccb1ae85e78e8ab3a326b8 /tool/vcs.rb
parentd72bd190a80e6b8258ca923b606175754a210b6d (diff)
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/vcs.rb')
-rw-r--r--tool/vcs.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 7dadada..d7f92bd 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)