version.c: last commit title
* version.c (ruby_show_version): show last commit title, if different than the trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d9f497f7e
commit
a8e289374a
@ -47,7 +47,7 @@ rescue VCS::NotFoundError => e
|
|||||||
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
|
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
last, changed, modified, branch = vcs.get_revisions(ARGV.shift)
|
last, changed, modified, branch, title = vcs.get_revisions(ARGV.shift)
|
||||||
rescue => e
|
rescue => e
|
||||||
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
|
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
|
||||||
exit false
|
exit false
|
||||||
@ -65,6 +65,9 @@ when :revision_h
|
|||||||
name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e}
|
name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e}
|
||||||
puts "#define RUBY_BRANCH_NAME #{name.dump}"
|
puts "#define RUBY_BRANCH_NAME #{name.dump}"
|
||||||
end
|
end
|
||||||
|
if title
|
||||||
|
puts "#define RUBY_LAST_COMMIT_TITLE #{title.dump}"
|
||||||
|
end
|
||||||
when :doxygen
|
when :doxygen
|
||||||
puts "r#{changed}/r#{last}"
|
puts "r#{changed}/r#{last}"
|
||||||
when :modified
|
when :modified
|
||||||
|
@ -260,6 +260,7 @@ class VCS
|
|||||||
logcmd << "--grep=^ *git-svn-id: .*@[0-9][0-9]*"
|
logcmd << "--grep=^ *git-svn-id: .*@[0-9][0-9]*"
|
||||||
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
|
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
|
||||||
log = IO.pread(logcmd)
|
log = IO.pread(logcmd)
|
||||||
|
commit = log[/\Acommit (\w+)/, 1]
|
||||||
last = log[idpat, 1]
|
last = log[idpat, 1]
|
||||||
if path
|
if path
|
||||||
cmd = logcmd
|
cmd = logcmd
|
||||||
@ -271,7 +272,9 @@ class VCS
|
|||||||
end
|
end
|
||||||
modified = log[/^Date:\s+(.*)/, 1]
|
modified = log[/^Date:\s+(.*)/, 1]
|
||||||
branch = IO.pread(gitcmd + %W[symbolic-ref HEAD])[%r'\A(?:refs/heads/)?(.+)', 1]
|
branch = IO.pread(gitcmd + %W[symbolic-ref HEAD])[%r'\A(?:refs/heads/)?(.+)', 1]
|
||||||
[last, changed, modified, branch]
|
title = IO.pread(gitcmd + ["log", "--format=%s", "-n1", "#{commit}..HEAD"])
|
||||||
|
title = nil if title.empty?
|
||||||
|
[last, changed, modified, branch, title]
|
||||||
end
|
end
|
||||||
|
|
||||||
Branch = Struct.new(:to_str)
|
Branch = Struct.new(:to_str)
|
||||||
|
@ -78,6 +78,9 @@ void
|
|||||||
ruby_show_version(void)
|
ruby_show_version(void)
|
||||||
{
|
{
|
||||||
PRINT(description);
|
PRINT(description);
|
||||||
|
#ifdef RUBY_LAST_COMMIT_TITLE
|
||||||
|
fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout);
|
||||||
|
#endif
|
||||||
#ifdef HAVE_MALLOC_CONF
|
#ifdef HAVE_MALLOC_CONF
|
||||||
if (malloc_conf) printf("malloc_conf=%s\n", malloc_conf);
|
if (malloc_conf) printf("malloc_conf=%s\n", malloc_conf);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user