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

ruby-changes:59400

From: Nobuyoshi <ko1@a...>
Date: Mon, 23 Dec 2019 14:18:08 +0900 (JST)
Subject: [ruby-changes:59400] 80d5d220b9 (master): Fix typo in commit logs by log-fix notes

https://git.ruby-lang.org/ruby.git/commit/?id=80d5d220b9

From 80d5d220b948517306e23b18260768ab8fe008bc Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 23 Dec 2019 08:42:53 +0900
Subject: Fix typo in commit logs by log-fix notes


diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index 1868553..3553ed5 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -613,6 +613,8 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L613
                            chdir: @srcdir, exception: false)
         abort "Could not fetch notes/commits tree"
       end
+      system(*%W"#{COMMAND} fetch origin refs/notes/log-fix:refs/notes/log-fix",
+               chdir: @srcdir, exception: false)
       to ||= url.to_str
       if from
         arg = ["#{from}^..#{to}"]
@@ -628,14 +630,32 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L630
 
     def format_changelog(path, arg)
       env = {'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}
-      cmd = %W"#{COMMAND} log --format=medium --notes=commits --topo-order --no-merges"
+      cmd = %W"#{COMMAND} log --format=medium --notes=commits --notes=log-fix --topo-order --no-merges"
       date = "--date=iso-local"
       unless system(env, *cmd, date, chdir: @srcdir, out: NullDevice, exception: false)
         date = "--date=iso"
       end
       cmd << date
       cmd.concat(arg)
-      system(env, *cmd, chdir: @srcdir, out: path)
+      File.open(path, 'w') do |w|
+        cmd_pipe(env, cmd, chdir: @srcdir) do |r|
+          while s = r.gets("\ncommit ")
+            if s.sub!(/\nNotes \(log-fix\):\n((?: +.*\n)+)/, '')
+              fix = $1
+              h, s = s.split(/^$/, 2)
+              s = s.lines
+              fix.each_line do |x|
+                if %r[^ +(\d+)s/(.+)/(.+)/] =~ x
+                  s[$1.to_i][$2] = $3
+                end
+              end
+              s = [h, s.join('')].join('')
+            end
+            s.gsub!(/ +\n/, "\n")
+            w.print s
+          end
+        end
+      end
     end
 
     def format_changelog_as_svn(path, arg)
-- 
cgit v0.10.2


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

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