##// END OF EJS Templates
Fixed that Redmine::VERSION.revision returns nil with svn 1.7 (#12012)....
Jean-Philippe Lang -
r10405:7af1504672d8
parent child
Show More
@@ -1,44 +1,37
1 1 require 'rexml/document'
2 2
3 3 module Redmine
4 4 module VERSION #:nodoc:
5 5 MAJOR = 2
6 6 MINOR = 1
7 7 TINY = 2
8 8
9 9 # Branch values:
10 10 # * official release: nil
11 11 # * stable branch: stable
12 12 # * trunk: devel
13 13 BRANCH = 'devel'
14 14
15 # Retrieves the revision from the working copy
15 16 def self.revision
16 revision = nil
17 entries_path = "#{Rails.root}/.svn/entries"
18 if File.readable?(entries_path)
17 if File.directory?(File.join(Rails.root, '.svn'))
19 18 begin
20 f = File.open(entries_path, 'r')
21 entries = f.read
22 f.close
23 if entries.match(%r{^\d+})
24 revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s})
25 else
26 xml = REXML::Document.new(entries)
27 revision =
28 xml.elements['wc-entries'].elements[1].attributes['revision'].to_i
19 path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s)
20 if `svn info --xml #{path}` =~ /revision="(\d+)"/
21 return $1.to_i
29 22 end
30 23 rescue
31 24 # Could not find the current revision
32 25 end
33 26 end
34 revision
27 nil
35 28 end
36 29
37 30 REVISION = self.revision
38 31 ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact
39 32 STRING = ARRAY.join('.')
40 33
41 34 def self.to_a; ARRAY end
42 35 def self.to_s; STRING end
43 36 end
44 37 end
General Comments 0
You need to be logged in to leave comments. Login now