From 63491598c6870c3097833d2a4666f38098b6b238 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 Jan 2015 12:56:10 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/vcs.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tool/vcs.rb') diff --git a/tool/vcs.rb b/tool/vcs.rb index d7559a7406..9371ae287d 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -135,7 +135,8 @@ class VCS info_xml = IO.pread(%W"svn info --xml #{path}") _, last, _, changed, _ = info_xml.split(/revision="(\d+)"/) modified = info_xml[/([^<>]*)/, 1] - [last, changed, modified] + branch = info_xml[%r'\^/(?:branches/|tags/)?([^<>]*)', 1] + [last, changed, modified, branch] end def url @@ -205,7 +206,11 @@ class VCS 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) -- cgit v1.2.3