VCS#revision_header: Make arguments optional

This commit is contained in:
Nobuyoshi Nakada 2022-09-01 19:54:46 +09:00
parent f67ab7f30c
commit 462a8be511
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
3 changed files with 5 additions and 5 deletions

View File

@ -76,7 +76,7 @@ exit unless vcs
} }
when :revision_h when :revision_h
Proc.new {|last, changed, modified, branch, title| Proc.new {|last, changed, modified, branch, title|
vcs.revision_header(last, changed, modified, branch, title, limit: @limit) vcs.revision_header(last, modified, branch, title, limit: @limit)
} }
when :doxygen when :doxygen
Proc.new {|last, changed| Proc.new {|last, changed|

View File

@ -204,7 +204,7 @@ class VCS
revision_handler(rev).short_revision(rev) revision_handler(rev).short_revision(rev)
end end
def revision_header(last, changed, modified, branch, title, limit: 20, time: true) def revision_header(last, modified = nil, branch = nil, title = nil, limit: 20)
short = short_revision(last) short = short_revision(last)
if /[^\x00-\x7f]/ =~ title and title.respond_to?(:force_encoding) if /[^\x00-\x7f]/ =~ title and title.respond_to?(:force_encoding)
title = title.dup.force_encoding("US-ASCII") title = title.dup.force_encoding("US-ASCII")
@ -225,7 +225,7 @@ class VCS
title = title.dump.sub(/\\#/, '#') title = title.dump.sub(/\\#/, '#')
code << "#define RUBY_LAST_COMMIT_TITLE #{title}" code << "#define RUBY_LAST_COMMIT_TITLE #{title}"
end end
if modified and time if modified
t = modified.utc t = modified.utc
code << t.strftime('#define RUBY_RELEASE_DATETIME "%FT%TZ"') code << t.strftime('#define RUBY_RELEASE_DATETIME "%FT%TZ"')
end end

View File

@ -309,7 +309,7 @@ def package(vcs, rev, destdir, tmp = nil)
warn "#{$0}: #{rev} not found" warn "#{$0}: #{rev} not found"
return return
end end
revision = (info = vcs.get_revisions(url))[1] revision = vcs.get_revisions(url)[1]
end end
v = "ruby" v = "ruby"
@ -346,7 +346,7 @@ def package(vcs, rev, destdir, tmp = nil)
end end
File.open("#{v}/revision.h", "wb") {|f| File.open("#{v}/revision.h", "wb") {|f|
f.puts vcs.revision_header(*info, time: false) f.puts vcs.revision_header(revision)
} }
version ||= (versionhdr = IO.read("#{v}/version.h"))[RUBY_VERSION_PATTERN, 1] version ||= (versionhdr = IO.read("#{v}/version.h"))[RUBY_VERSION_PATTERN, 1]
version ||= version ||=