summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtool/file2lastrev.rb5
-rw-r--r--tool/vcs.rb9
-rw-r--r--version.h6
3 files changed, 14 insertions, 6 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 616c5f7..de4b928 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -47,7 +47,7 @@ rescue VCS::NotFoundError => e
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
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
diff --git a/tool/vcs.rb b/tool/vcs.rb
index d7559a7..9371ae2 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[/<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
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)
diff --git a/version.h b/version.h
index b248842..f2aca00 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,6 @@
#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 @@
#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)