Project

General

Profile

Defect #2664 » hg-ruby-1.9.diff

Toshi MARUYAMA, 2011-02-07 12:15

View differences:

lib/redmine/scm/adapters/abstract_adapter.rb
81 81
        
82 82
        # Returns the entry identified by path and revision identifier
83 83
        # or nil if entry doesn't exist in the repository
84
        def entry(path=nil, identifier=nil)
84
        def entry(path=nil, identifier=nil, path_encoding='UTF-8')
85 85
          parts = path.to_s.split(%r{[\/\\]}).select {|n| !n.blank?}
86 86
          search_path = parts[0..-2].join('/')
87 87
          search_name = parts[-1]
......
90 90
            Entry.new(:path => '', :kind => 'dir')
91 91
          else
92 92
            # Search for the entry in the parent directory
93
            es = entries(search_path, identifier)
93
            es = entries(search_path, identifier, path_encoding)
94 94
            es ? es.detect {|e| e.name == search_name} : nil
95 95
          end
96 96
        end
97 97
        
98 98
        # Returns an Entries collection
99 99
        # or nil if the given path doesn't exist in the repository
100
        def entries(path=nil, identifier=nil)
100
        def entries(path=nil, identifier=nil, path_encoding='UTF-8')
101 101
          return nil
102 102
        end
103 103

  
lib/redmine/scm/adapters/mercurial_adapter.rb
77 77
          return nil
78 78
        end
79 79

  
80
        def entries(path=nil, identifier=nil)
80
        def entries(path=nil, identifier=nil, path_encoding='UTF-8')
81 81
          path ||= ''
82 82
          entries = Entries.new
83 83
          cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate"
......
86 86
          shellout(cmd) do |io|
87 87
            io.each_line do |line|
88 88
              # HG uses antislashs as separator on Windows
89
              if line.respond_to?(:force_encoding)
90
                line.force_encoding(path_encoding)
91
              end
89 92
              line = line.gsub(/\\/, "/")
90 93
              if path.empty? or e = line.gsub!(%r{^#{with_trailling_slash(path)}},'')
91 94
                e ||= line
lib/redmine/scm/adapters/path_encodable_wrapper.rb
29 29
          @path_encoding = path_encoding
30 30
        end
31 31

  
32
        def entry(path=nil, identifier=nil)
33
          convert_entry!(super(to_scm_path(path), identifier))
32
        def entry(path=nil, identifier=nil, path_encoding='UTF-8')
33
          convert_entry!(super(to_scm_path(path), identifier, @path_encoding))
34 34
        end
35 35

  
36
        def entries(path=nil, identifier=nil)
37
          convert_entries!(super(to_scm_path(path), identifier))
36
        def entries(path=nil, identifier=nil, path_encoding='UTF-8')
37
          convert_entries!(super(to_scm_path(path), identifier, @path_encoding))
38 38
        end
39 39

  
40 40
        def properties(path, identifier=nil)
(6-6/8)