diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-04-22 21:23:37 +0900 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-04-22 21:27:34 +0900 |
commit | 5da52d1210625fb00acd573b3f32281b4bde1730 (patch) | |
tree | b21d24b02dfc1da995bc280142e2aaffcedf30ba /tool | |
parent | dd0b516399f1e009667a99e815bf86c6a1245ee5 (diff) | |
download | ruby-5da52d1210625fb00acd573b3f32281b4bde1730.tar.gz |
Migrate RUBY_VERSION/RUBY_DESCRIPTION to Git
from Subversion.
This behavior is tentative and not discussed well. The point of
discussion will be just the length of commit hash, and I thought we
should include this kind of change in 2.7.0-preview1 release even before
the length is fixed yet.
Let's discuss that afterwards and fix it later as needed. Naruse
suggested that length=10 is very unlikely to cause conflict, and thus
it's used by email notification and rubyci now. This behavior is in
favor of that for now.
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/file2lastrev.rb | 2 | ||||
-rw-r--r-- | tool/vcs.rb | 21 |
2 files changed, 6 insertions, 17 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 8d68da9f88..0ee22da712 100755 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -54,7 +54,7 @@ parser.parse! rescue abort "#{File.basename(Program)}: #{$!}\n#{parser}" when :revision_h Proc.new {|last, changed, modified, branch, title| [ - "#define RUBY_REVISION #{changed || 0}", + "#define RUBY_REVISION \"#{changed[0...10]}\"", if branch e = '..' limit = 16 diff --git a/tool/vcs.rb b/tool/vcs.rb index b97334ecfb..d63336ae60 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -374,27 +374,16 @@ class VCS def self.get_revisions(path, srcdir = nil) gitcmd = [COMMAND] - desc = cmd_read_at(srcdir, [gitcmd + %w[describe --tags --match REV_*]]) - if /\AREV_(\d+)(?:-(\d+)-g\h+)?\Z/ =~ desc - last = ($1.to_i + $2.to_i).to_s - end - logcmd = gitcmd + %W[log -n1 --date=iso] - logcmd << "--grep=^ *git-svn-id: .*@[0-9][0-9]*" unless last - idpat = /git-svn-id: .*?@(\d+) \S+\Z/ - log = cmd_read_at(srcdir, [logcmd]) - commit = log[/\Acommit (\w+)/, 1] - last ||= log[idpat, 1] + last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', 'HEAD']]).rstrip if path - cmd = logcmd - cmd += [path] unless path == '.' - log = cmd_read_at(srcdir, [cmd]) - changed = log[idpat, 1] || last + log = cmd_read_at(srcdir, [[*gitcmd, 'log', '-n1', '--date=iso', path]]) else - changed = last + log = cmd_read_at(srcdir, [[*gitcmd, 'log', '-n1', '--date=iso']]) end + changed = log[/\Acommit (\h+)/, 1] modified = log[/^Date:\s+(.*)/, 1] branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref HEAD]])[%r'\A(?:refs/heads/)?(.+)', 1] - title = cmd_read_at(srcdir, [gitcmd + %W[log --format=%s -n1 #{commit}..HEAD]]) + title = cmd_read_at(srcdir, [gitcmd + %W[log --format=%s -n1 HEAD]]) title = nil if title.empty? [last, changed, modified, branch, title] end |