summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-22 23:18:37 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-22 23:53:21 +0900
commita205e24747497391390ef7c004293a8a7934dd96 (patch)
tree404c7576caf233c612a78966047de8218beebf57 /tool/vcs.rb
parentd819d97cf02fd0a5b5b1f6ee69c9fdb83276e6c2 (diff)
Make RUBY_REVISION full length
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index f251c96..34bafa7 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -224,6 +224,10 @@ class VCS
self.class.revision_name(rev)
end
+ def short_revision(rev)
+ self.class.short_revision(rev)
+ end
+
class SVN < self
register(".svn")
COMMAND = ENV['SVN'] || 'svn'
@@ -232,6 +236,10 @@ class VCS
"r#{rev}"
end
+ def self.short_revision(rev)
+ rev
+ end
+
def self.get_revisions(path, srcdir = nil)
if srcdir and local_path?(path)
path = File.join(srcdir, path)
@@ -392,10 +400,9 @@ class VCS
def self.get_revisions(path, srcdir = nil)
gitcmd = [COMMAND]
- last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', '--short=10', 'HEAD']]).rstrip
+ last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', 'HEAD']]).rstrip
log = cmd_read_at(srcdir, [[*gitcmd, 'log', '-n1', '--date=iso', *path]])
changed = log[/\Acommit (\h+)/, 1]
- changed = changed[0, last.size]
modified = log[/^Date:\s+(.*)/, 1]
branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref --short HEAD]])
if branch.empty?
@@ -413,7 +420,11 @@ class VCS
end
def self.revision_name(rev)
- rev
+ short_revision(rev)
+ end
+
+ def self.short_revision(rev)
+ rev[0, 10]
end
def initialize(*)
@@ -533,6 +544,10 @@ class VCS
SVN.revision_name(rev)
end
+ def self.short_revision(rev)
+ SVN.short_revision(rev)
+ end
+
def format_changelog(r, path)
open(path, 'w') do |w|
sep = "-"*72