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

ruby-changes:37220

From: nobu <ko1@a...>
Date: Sat, 17 Jan 2015 21:56:26 +0900 (JST)
Subject: [ruby-changes:37220] nobu:r49301 (trunk): version.h: include branch name

nobu	2015-01-17 21:56:10 +0900 (Sat, 17 Jan 2015)

  New Revision: 49301

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

  Log:
    version.h: include branch name
    
    * tool/file2lastrev.rb, tool/vcs.rb (get_revisions): define
      RUBY_BRANCH_NAME from the current branch name.
    
    * version.h (RUBY_REVISION_STR): include the current branch name
      not "trunk" always.

  Modified files:
    trunk/tool/file2lastrev.rb
    trunk/tool/vcs.rb
    trunk/version.h
Index: version.h
===================================================================
--- version.h	(revision 49300)
+++ version.h	(revision 49301)
@@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2015-01-17"
 #define RUBY_PATCHLEVEL -1
-#define RUBY_BRANCH_NAME "trunk"
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
@@ -31,7 +30,10 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L30
 #endif
 
 #if RUBY_REVISION
-# ifdef RUBY_BRANCH_NAME
+# if RUBY_PATCHLEVEL == -1
+#  ifndef RUBY_BRANCH_NAME
+#   define RUBY_BRANCH_NAME "trunk"
+#  endif
 #  define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION)
 # else
 #  define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION)
Index: tool/vcs.rb
===================================================================
--- tool/vcs.rb	(revision 49300)
+++ tool/vcs.rb	(revision 49301)
@@ -135,7 +135,8 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L135
       info_xml = IO.pread(%W"svn info --xml #{path}")
       _, last, _, changed, _ = info_xml.split(/revision="(\d+)"/)
       modified = info_xml[/<date>([^<>]*)/, 1]
-      [last, changed, modified]
+      branch = info_xml[%r'<relative-url>\^/(?:branches/|tags/)?([^<>]*)', 1]
+      [last, changed, modified, branch]
     end
 
     def url
@@ -205,7 +206,11 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L206
         changed = last
       end
       modified = log[/^Date:\s+(.*)/, 1]
-      [last, changed, modified]
+      cmd = %W[git]
+      cmd.push("-C", srcdir) if srcdir
+      cmd.push("symbolic-ref", "HEAD")
+      branch = IO.pread(cmd)[%r'\A(?:refs/heads/)?(.*)', 1]
+      [last, changed, modified, branch]
     end
 
     Branch = Struct.new(:to_str)
Index: tool/file2lastrev.rb
===================================================================
--- tool/file2lastrev.rb	(revision 49300)
+++ tool/file2lastrev.rb	(revision 49301)
@@ -47,7 +47,7 @@ rescue VCS::NotFoundError => e https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L47
   abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
 else
   begin
-    last, changed, modified = vcs.get_revisions(ARGV.shift)
+    last, changed, modified, branch = vcs.get_revisions(ARGV.shift)
   rescue => e
     abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
     exit false
@@ -58,7 +58,8 @@ case @output https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L58
 when :changed, nil
   puts changed
 when :revision_h
-  puts "#define RUBY_REVISION #{changed.to_i}"
+  puts "#define RUBY_REVISION #{changed || 0}"
+  puts "#define RUBY_BRANCH_NAME #{branch.dump}" if branch
 when :doxygen
   puts "r#{changed}/r#{last}"
 when :modified

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

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