[前][次][番号順一覧][スレッド一覧]

ruby-changes:55573

From: Nobuyoshi <ko1@a...>
Date: Sun, 28 Apr 2019 13:48:09 +0900 (JST)
Subject: [ruby-changes:55573] Nobuyoshi Nakada:4c8f107898 (trunk): Make the range to export as changelog optional

https://git.ruby-lang.org/ruby.git/commit/?id=4c8f107898

From 4c8f1078985613ea1015fe1a1cdbe9944528cb35 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
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.

diff --git a/tool/make-snapshot b/tool/make-snapshot
index 6161335..d81a28c 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -338,11 +338,7 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L338
   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 7dadada..d7f92bd 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -355,7 +355,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L355
     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 https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L481
     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 https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L489
                          "--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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]