ruby-changes:38531
From: nobu <ko1@a...>
Date: Sat, 23 May 2015 18:36:16 +0900 (JST)
Subject: [ruby-changes:38531] nobu:r50612 (trunk): file2lastrev.rb: all ARGV
nobu 2015-05-23 18:36:05 +0900 (Sat, 23 May 2015) New Revision: 50612 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50612 Log: file2lastrev.rb: all ARGV * tool/file2lastrev.rb: output for each arguments. Modified files: trunk/tool/file2lastrev.rb Index: tool/file2lastrev.rb =================================================================== --- tool/file2lastrev.rb (revision 50611) +++ tool/file2lastrev.rb (revision 50612) @@ -40,38 +40,53 @@ parser = OptionParser.new {|opts| https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L40 } parser.parse! rescue abort "#{File.basename(Program)}: #{$!}\n#{parser}" +@output = + case @output + when :changed, nil + proc {|last, changed| + changed + } + when :revision_h + proc {|last, changed, modified, branch, title| + [ + "#define RUBY_REVISION #{changed || 0}", + if branch + e = '..' + limit = 16 + name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e} + "#define RUBY_BRANCH_NAME #{name.dump}" + end, + if title + "#define RUBY_LAST_COMMIT_TITLE #{title.dump}" + end, + ].compact + } + when :doxygen + proc {|last, changed| + "r#{changed}/r#{last}" + } + when :modified + proc {|last, changed, modified| + modified.strftime('%Y-%m-%dT%H:%M:%S%z') + } + else + raise "unknown output format `#{@output}'" + end + srcdir ||= File.dirname(File.dirname(Program)) begin vcs = VCS.detect(srcdir) rescue VCS::NotFoundError => e abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found else - begin - last, changed, modified, branch, title = vcs.get_revisions(ARGV.shift) - rescue => e - abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found - exit false + ok = true + (ARGV.empty? ? [nil] : ARGV).each do |arg| + begin + puts @output[*vcs.get_revisions(arg)] + rescue => e + warn "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found + ok = false + end end -end - -case @output -when :changed, nil - puts changed -when :revision_h - puts "#define RUBY_REVISION #{changed || 0}" - if branch - e = '..' - limit = 16 - name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e} - puts "#define RUBY_BRANCH_NAME #{name.dump}" - end - if title - puts "#define RUBY_LAST_COMMIT_TITLE #{title.dump}" - end -when :doxygen - puts "r#{changed}/r#{last}" -when :modified - puts modified.strftime('%Y-%m-%dT%H:%M:%S%z') -else - raise "unknown output format `#{@output}'" + exit ok end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/