From 4c8f1078985613ea1015fe1a1cdbe9944528cb35 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 28 Apr 2019 12:16:40 +0900 Subject: 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. --- tool/vcs.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tool/vcs.rb') 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) -- cgit v1.2.3