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,7 +92,11 @@ def svnparse(url)
body = fetch("#{url}/.svn/entries").body body = fetch("#{url}/.svn/entries").body
rescue rescue
end end
if body.nil?
return
end
dirs = Array.new dirs = Array.new
if body[0].chr == '<'
xmldoc = REXML::Document.new(body) xmldoc = REXML::Document.new(body)
xmldoc.elements.each("wc-entries/entry") {|item| xmldoc.elements.each("wc-entries/entry") {|item|
case item.attribute("kind").to_s case item.attribute("kind").to_s
@ -108,7 +112,37 @@ def svnparse(url)
puts " Strange kind #{item.attribute("kind")}" puts " Strange kind #{item.attribute("kind")}"
end 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| dirs.each{|dir|
#p "#{url}/#{dir}"
svnparse("#{url}/#{dir}") svnparse("#{url}/#{dir}")
} }
end end