@@ -12,26 +12,19 module Redmine | |||||
12 | # * trunk: devel |
|
12 | # * trunk: devel | |
13 | BRANCH = 'devel' |
|
13 | BRANCH = 'devel' | |
14 |
|
14 | |||
|
15 | # Retrieves the revision from the working copy | |||
15 | def self.revision |
|
16 | def self.revision | |
16 | revision = nil |
|
17 | if File.directory?(File.join(Rails.root, '.svn')) | |
17 | entries_path = "#{Rails.root}/.svn/entries" |
|
|||
18 | if File.readable?(entries_path) |
|
|||
19 | begin |
|
18 | begin | |
20 | f = File.open(entries_path, 'r') |
|
19 | path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s) | |
21 | entries = f.read |
|
20 | if `svn info --xml #{path}` =~ /revision="(\d+)"/ | |
22 | f.close |
|
21 | return $1.to_i | |
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 |
|
|||
29 | end |
|
22 | end | |
30 | rescue |
|
23 | rescue | |
31 | # Could not find the current revision |
|
24 | # Could not find the current revision | |
32 | end |
|
25 | end | |
33 | end |
|
26 | end | |
34 |
|
|
27 | nil | |
35 | end |
|
28 | end | |
36 |
|
29 | |||
37 | REVISION = self.revision |
|
30 | REVISION = self.revision |
General Comments 0
You need to be logged in to leave comments.
Login now