ruby-changes:9467
From: yugui <ko1@a...>
Date: Thu, 25 Dec 2008 18:52:44 +0900 (JST)
Subject: [ruby-changes:9467] Ruby:r21005 (ruby_1_9_1): merges r20920, r20936, r20939 and r20966 from trunk into ruby_1_9_1.
yugui 2008-12-25 18:52:16 +0900 (Thu, 25 Dec 2008) New Revision: 21005 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21005 Log: merges r20920, r20936, r20939 and r20966 from trunk into ruby_1_9_1. * common.mk (revision.h): uses tool/file2lastrev.rb to support git-svn. * version.h: changed version string as `ruby 1.9.1 (2008-12-22 patchlevel-5000 trunk 20912) [i386-darwin9.6.0]'. * tool/file2lastrev.rb: wrapper script that abstracts subversion and git-svn. Added files: branches/ruby_1_9_1/tool/file2lastrev.rb Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/common.mk branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 21004) +++ ruby_1_9_1/ChangeLog (revision 21005) @@ -1,3 +1,26 @@ +Wed Dec 24 20:15:50 2008 Koichi Sasada <ko1@a...> + + * tool/file2lastrev.rb (get_revisions): fix to ignore end of line. + +Tue Dec 23 15:48:55 2008 NAKAMURA Usaku <usa@r...> + + * tool/file2lastrev.rb: shouldn't use single quote in shell's command + line if you want to support Windows. + +Tue Dec 23 15:36:58 2008 Yuki Sonoda (Yugui) <yugui@y...> + + * tool/file2lastrev.rb: detects vcs directory properly on + building outside of srcdir. [ruby-dev:37555] [ruby-dev:37561] + +Mon Dec 22 19:31:19 2008 Yuki Sonoda (Yugui) <yugui@y...> + + * common.mk (revision.h): uses tool/file2lastrev.rb to support + git-svn. + + * version.h: changed version string as + `ruby 1.9.1 (2008-12-22 patchlevel-5000 trunk 20912) + [i386-darwin9.6.0]'. + Mon Dec 22 21:08:54 2008 Tanaka Akira <akr@f...> * lib/test/unit/assertions.rb (assert_nothing_raised): increment Index: ruby_1_9_1/common.mk =================================================================== --- ruby_1_9_1/common.mk (revision 21004) +++ ruby_1_9_1/common.mk (revision 21005) @@ -674,10 +674,8 @@ preludes: {$(VPATH)}miniprelude.c preludes: {$(srcdir)}golf_prelude.c -$(srcdir)/revision.h: $(srcdir)/version.h $(srcdir)/ChangeLog $(REVISION_FORCE) - @set LC_MESSAGES=C - -@$(SET_LC_MESSAGES) $(VCS) info "$(@D)" | \ - sed -n "s/.*Rev:/#define RUBY_REVISION/p" > "$@.tmp" +$(srcdir)/revision.h: $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastrev.rb $(REVISION_FORCE) + $(BASERUBY) $(srcdir)/tool/file2lastrev.rb --revision.h "$(@D)" > "$@.tmp" @$(IFCHANGE) "$@" "$@.tmp" $(srcdir)/ext/ripper/ripper.c: Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 21004) +++ ruby_1_9_1/version.h (revision 21005) @@ -30,20 +30,16 @@ #define RUBY_REVISION 0 #endif -#if RUBY_PATCHLEVEL -#define RUBY_PATCHLEVEL_STR " patchlevel "STRINGIZE(RUBY_PATCHLEVEL) -#else -#define RUBY_PATCHLEVEL_STR "" -#endif +#define RUBY_PATCHLEVEL_STR " patchlevel-"STRINGIZE(RUBY_PATCHLEVEL) #if RUBY_REVISION -#ifdef RUBY_BRANCH_NAME -#define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION) +# ifdef RUBY_BRANCH_NAME +# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION) +# else +# define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION) +# endif #else -#define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION) +# define RUBY_REVISION_STR "" #endif -#else -#define RUBY_REVISION_STR "" -#endif # define RUBY_DESCRIPTION \ "ruby "RUBY_VERSION \ Index: ruby_1_9_1/tool/file2lastrev.rb =================================================================== --- ruby_1_9_1/tool/file2lastrev.rb (revision 0) +++ ruby_1_9_1/tool/file2lastrev.rb (revision 21005) @@ -0,0 +1,80 @@ +#!/usr/bin/env ruby + +require 'optparse' +require 'pathname' + +SRCDIR = Pathname(File.dirname($0)).parent.freeze +class VCSNotFoundError < RuntimeError; end + +def detect_vcs(path) + path = SRCDIR + return :svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.svn") + return :git, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git") + raise VCSNotFoundError, "does not seem to be under a vcs" +end + +def get_revisions(path) + ENV['LANG'] = ENV['LC_ALL'] = ENV['LC_MESSAGES'] = 'C' + vcs, path = detect_vcs(path) + + info = case vcs + when :svn + `cd "#{SRCDIR}" && svn info "#{path}"` + when :git + `cd "#{SRCDIR}" && git svn info "#{path}"` + end + + if info =~ /^Revision: (\d+)$/ + last = $1 + else + raise "last revision not found" + end + if info =~ /^Last Changed Rev: (\d+)$/ + changed = $1 + else + raise "changed revision not found" + end + + return last, changed +end + +def raise_if_conflict + raise "you can specify only one of --changed, --revision.h and --doxygen" if $output +end + +parser = OptionParser.new {|opts| + opts.on("--changed", "changed rev") do + raise_if_conflict + $output = :changed + end + opts.on("--revision.h") do + raise_if_conflict + $output = :revision_h + end + opts.on("--doxygen") do + raise_if_conflict + $output = :doxygen + end + opts.on("-q", "--suppress_not_found") do + $suppress_not_found = true + end +} +parser.parse! + + +begin + last, changed = get_revisions(ARGV.shift) +rescue VCSNotFoundError + raise unless $suppress_not_found +end + +case $output +when :changed, nil + puts changed +when :revision_h + puts "#define RUBY_REVISION #{changed}" +when :doxygen + puts "r#{changed}/r#{last}" +else + raise "unknown output format `#{$output}'" +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/