Project

General

Profile

Defect #6860 » svn-version.diff

Toshi MARUYAMA, 2010-11-12 13:34

View differences:

lib/redmine/scm/adapters/subversion_adapter.rb
30 30
          def client_version
31 31
            @@client_version ||= (svn_binary_version || [])
32 32
          end
33
          
33

  
34 34
          def svn_binary_version
35 35
            cmd = "#{SVN_BIN} --version"
36 36
            version = nil
37
            buf = []
37 38
            shellout(cmd) do |io|
38
              # Read svn version in first returned line
39
              if m = io.gets.to_s.match(%r{((\d+\.)+\d+)})
40
                version = m[0].scan(%r{\d+}).collect(&:to_i)
39
              io.each_line do |line|
40
                buf << line
41 41
              end
42 42
            end
43 43
            return nil if $? && $?.exitstatus != 0
44
            return nil if buf.empty?
45

  
46
            # Read svn version in first returned line
47
            if m = buf[0].match(%r{((\d+\.)+\d+)})
48
              version = m[0].scan(%r{\d+}).collect(&:to_i)
49
            end
44 50
            version
45 51
          end
46 52
        end
47
        
53

  
48 54
        # Get info about the svn repository
49 55
        def info
50 56
          cmd = "#{SVN_BIN} info --xml #{target}"
(2-2/2)