aboutsummaryrefslogtreecommitdiffstats
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 08:56:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 08:56:58 +0000
commit6ef19f6231add66fd5c29f1566206a089d9b89ae (patch)
treeddfd2608ef5162f6963c1e6f98a1d0c7e010cb4b /tool/vcs.rb
parentf194ddb1a576ae3a4bb4bb14fa457687868c91aa (diff)
downloadruby-6ef19f6231add66fd5c29f1566206a089d9b89ae.tar.gz
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
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 6925660f20..3002d417a1 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -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 == '.'