mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
2432796e1b
commit
f5f328d497
1 changed files with 6 additions and 2 deletions
|
@ -345,12 +345,16 @@ class VCS
|
||||||
|
|
||||||
def self.get_revisions(path, srcdir = nil)
|
def self.get_revisions(path, srcdir = nil)
|
||||||
gitcmd = [COMMAND]
|
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 = 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/
|
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
|
||||||
log = cmd_read_at(srcdir, [logcmd])
|
log = cmd_read_at(srcdir, [logcmd])
|
||||||
commit = log[/\Acommit (\w+)/, 1]
|
commit = log[/\Acommit (\w+)/, 1]
|
||||||
last = log[idpat, 1]
|
last ||= log[idpat, 1]
|
||||||
if path
|
if path
|
||||||
cmd = logcmd
|
cmd = logcmd
|
||||||
cmd += [path] unless path == '.'
|
cmd += [path] unless path == '.'
|
||||||
|
|
Loading…
Add table
Reference in a new issue