diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-27 01:41:29 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-27 01:41:29 +0000 |
commit | 634f2c36033e59883eb1ef11aafa73c339c4c4ba (patch) | |
tree | 8a2bb8d632428c8153e822986f665390c499ae41 /bin | |
parent | e271af52bf0a7ac9796bafb04052ee073cd40738 (diff) |
Check if the SVN_DIR is actually a git dir, and change accordingly
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rbot | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -42,22 +42,26 @@ $version="0.9.11-svn" $opts = Hash.new if $version =~ /svn/ - up = File.dirname(__FILE__) + "/.." - rev = " (unknown revision)" - begin - svn_out = `svn info #{up}` - if svn_out =~ /Last Changed Rev: (\d+)/ - rev = " (revision #{$1}" + if defined?(SVN_DIR) and File.exists?(File.join(SVN_DIR, '.git')) + $version.sub!('svn', 'git') + else + up = File.dirname(__FILE__) + "/.." + rev = " (unknown revision)" + begin + svn_out = `svn info #{up}` + if svn_out =~ /Last Changed Rev: (\d+)/ + rev = " (revision #{$1}" + end + svn_st = `svn st #{up}` + if svn_st =~ /^[MDA] / + rev << ", local changes" + end + rev << ")" + rescue => e + puts e.inspect end - svn_st = `svn st #{up}` - if svn_st =~ /^[MDA] / - rev << ", local changes" - end - rev << ")" - rescue => e - puts e.inspect + $version += rev end - $version += rev end orig_opts = ARGV.dup |