vcs.rb: try to extract revision number from tags

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-21 08:56:58 +00:00
Родитель 2432796e1b
Коммит f5f328d497
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -345,12 +345,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]*"
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 ||= log[idpat, 1]
if path
cmd = logcmd
cmd += [path] unless path == '.'