From f25283b05fee71c630573a6cabd5a3d95b1d74a8 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 1 Jan 2009 06:43:34 +0000 Subject: * tool/flie2lastrev.rb: supports git repositories which are cloned from a git-svn gateway. Patch by Hongli Lai. [ruby-core:21020] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ tool/file2lastrev.rb | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e79b984c..c24cde98d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 1 15:08:46 2009 Yuki Sonoda (Yugui) + + * tool/flie2lastrev.rb: supports git repositories which are cloned + from a git-svn gateway. + Patch by Hongli Lai. [ruby-core:21020] + Thu Jan 1 07:42:36 2009 Yukihiro Matsumoto * lib/singleton.rb: fix indentation of RDoc text. [ruby-core:21029] diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 37b27b2b8..cacd76eb6 100644 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -12,6 +12,7 @@ class VCSNotFoundError < RuntimeError; end def detect_vcs(path) path = SRCDIR return :svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.svn") + return :git_svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git/svn") return :git, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git") raise VCSNotFoundError, "does not seem to be under a vcs" end @@ -22,8 +23,12 @@ def get_revisions(path) info = case vcs when :svn `cd "#{SRCDIR}" && svn info "#{path}"` - when :git + when :git_svn `cd "#{SRCDIR}" && git svn info "#{path}"` + when :git + git_log = `cd "#{SRCDIR}" && git log HEAD~1..HEAD "#{path}"` + git_log =~ /git-svn-id: .*?@(\d+)/ + "Revision: #{$1}\nLast Changed Rev: #{$1}\n" end if /^Revision: (\d+)/ =~ info -- cgit