nieuw formaat ook snappen

This commit is contained in:
Ward Wouts 2008-09-30 12:38:04 +00:00
parent db30a683d8
commit 6a6d42f402

View file

@ -92,23 +92,57 @@ def svnparse(url)
body = fetch("#{url}/.svn/entries").body
rescue
end
if body.nil?
return
end
dirs = Array.new
xmldoc = REXML::Document.new(body)
xmldoc.elements.each("wc-entries/entry") {|item|
case item.attribute("kind").to_s
when "dir" then
if item.attribute("name").to_s == ""
next
if body[0].chr == '<'
xmldoc = REXML::Document.new(body)
xmldoc.elements.each("wc-entries/entry") {|item|
case item.attribute("kind").to_s
when "dir" then
if item.attribute("name").to_s == ""
next
end
puts "#{item.attribute("name")}/"
dirs.push(item.attribute("name").to_s)
when "file" then
puts "#{item.attribute("name")} #{item.attribute("last-author")} #{item.attribute("committed-date")}"
else
puts " Strange kind #{item.attribute("kind")}"
end
puts "#{item.attribute("name")}/"
dirs.push(item.attribute("name").to_s)
when "file" then
puts "#{item.attribute("name")} #{item.attribute("last-author")} #{item.attribute("committed-date")}"
else
puts " Strange kind #{item.attribute("kind")}"
end
}
}
else
lastline = ""
commitdate = ""
author = ""
bodyarr = Array.new
body.each_line{|line|
bodyarr.push line
}
(0...bodyarr.length).each{|count|
line = bodyarr[count]
line.chomp!
if line.match(/\d\d\d\d-\d\d-\d\dT/)
commitdate = line
author = bodyarr[count+2]
end
case line
when 'dir'
if lastline == ""
next
end
puts "#{lastline}/"
dirs.push lastline
when 'file'
puts "#{lastline} #{author} #{commitdate}"
else
lastline = line
end
}
end
dirs.each{|dir|
#p "#{url}/#{dir}"
svnparse("#{url}/#{dir}")
}
end