1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-20 07:21:12 +00:00

Merged Mercurial browsing fix from trunk (r1228 and r1229).

git-svn-id: http://redmine.rubyforge.org/svn/branches/0.6-stable@1230 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-03-12 17:54:50 +00:00
parent 75d652d9e5
commit abaeecbaa9

View File

@ -43,12 +43,12 @@ module Redmine
def entries(path=nil, identifier=nil) def entries(path=nil, identifier=nil)
path ||= '' path ||= ''
entries = Entries.new entries = Entries.new
cmd = "#{HG_BIN} -R #{target('')} --cwd #{target(path)} locate -X */*/*" cmd = "#{HG_BIN} -R #{target('')} --cwd #{target(path)} locate"
cmd << " -r #{identifier.to_i}" if identifier cmd << " -r #{identifier.to_i}" if identifier
cmd << " * */*" cmd << " " + shell_quote('glob:**')
shellout(cmd) do |io| shellout(cmd) do |io|
io.each_line do |line| io.each_line do |line|
e = line.chomp.split('\\') e = line.chomp.split(%r{[\/\\]})
entries << Entry.new({:name => e.first, entries << Entry.new({:name => e.first,
:path => (path.empty? ? e.first : "#{path}/#{e.first}"), :path => (path.empty? ? e.first : "#{path}/#{e.first}"),
:kind => (e.size > 1 ? 'dir' : 'file'), :kind => (e.size > 1 ? 'dir' : 'file'),