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

ruby-changes:44565

From: naruse <ko1@a...>
Date: Sun, 6 Nov 2016 21:57:50 +0900 (JST)
Subject: [ruby-changes:44565] naruse:r56638 (trunk): * tool/vcs.rb (export_changelog): generate ChangeLog file from

naruse	2016-11-06 21:57:45 +0900 (Sun, 06 Nov 2016)

  New Revision: 56638

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56638

  Log:
    * tool/vcs.rb (export_changelog): generate ChangeLog file from
      vcs's log. [Feature #12283]
    
    * tool/make-snapshot (package): overwrite ChangeLog by generated
      ChangeLog.

  Modified files:
    trunk/ChangeLog
    trunk/tool/make-snapshot
    trunk/tool/vcs.rb
Index: tool/make-snapshot
===================================================================
--- tool/make-snapshot	(revision 56637)
+++ tool/make-snapshot	(revision 56638)
@@ -205,6 +205,7 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L205
     end
   end
 
+  srcdir = File.realpath($srcdir)
   Dir.chdir(tmp) if tmp
 
   if !File.directory?(v)
@@ -212,6 +213,17 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L213
     v.size == 1 or abort "not exported"
     v = v[0]
   end
+
+  # get last revision from previous ChangeLog archive
+  last_ChangeLog = Dir["#{v}/doc/ChangeLog-*"].grep(/-\d+\z/).last
+  open(last_ChangeLog) do |f|
+    f.readline
+    unless /\Ar(\d+) / =~ f.readline
+      abort "Cannot find revision from '#{last_ChangeLog}'"
+    end
+    vcs.export_changelog(srcdir, url, $1.to_i+1, revision.to_i, "#{v}/ChangeLog")
+  end
+
   open("#{v}/revision.h", "wb") {|f| f.puts "#define RUBY_REVISION #{revision}"}
   version ||= (versionhdr = IO.read("#{v}/version.h"))[RUBY_VERSION_PATTERN, 1]
   version or return
Index: tool/vcs.rb
===================================================================
--- tool/vcs.rb	(revision 56637)
+++ tool/vcs.rb	(revision 56638)
@@ -280,6 +280,16 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L280
     def after_export(dir)
       FileUtils.rm_rf(dir+"/.svn")
     end
+
+    def export_changelog(srcdir, url, from, to, path)
+      IO.popen({'TZ' => 'JST-9'}, "svn log -r#{to}:#{from} #{url}") do |r|
+        open(path, 'w') do |w|
+          IO.copy_stream(r, w)
+        end
+      end
+      sleep 10
+      exit
+    end
   end
 
   class GIT < self
@@ -355,5 +365,15 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L365
     def after_export(dir)
       FileUtils.rm_rf("#{dir}/.git")
     end
+
+    def export_changelog(srcdir, url, from, to, path)
+      from = `git -C #{srcdir} log -n1 --format=format:%H --grep='^ *git-svn-id: .*@#{from} '`
+      to = `git -C #{srcdir} log -n1 --format=format:%H --grep='^ *git-svn-id: .*@#{to} '`
+      IO.popen({'TZ' => 'JST-9'}, "git -C #{srcdir} log --date=iso-local --topo-order #{from}..#{to}") do |r|
+        open(path, 'w') do |w|
+          IO.copy_stream(r, w)
+        end
+      end
+    end
   end
 end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56637)
+++ ChangeLog	(revision 56638)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov  6 21:54:28 2016  NARUSE, Yui  <naruse@r...>
+
+	* tool/vcs.rb (export_changelog): generate ChangeLog file from
+	  vcs's log. [Feature #12283]
+
+	* tool/make-snapshot (package): overwrite ChangeLog by generated
+	  ChangeLog.
+
 Sun Nov  6 21:36:33 2016  SHIBATA Hiroshi  <hsbt@r...>
 
 	* NEWS: Added entry for RDoc 5.

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

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