From 6a6d42f402913f459a645234ce70649ea3a7a30a Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Tue, 30 Sep 2008 12:38:04 +0000 Subject: [PATCH] nieuw formaat ook snappen --- listversioned/listversioned.rb | 62 ++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/listversioned/listversioned.rb b/listversioned/listversioned.rb index e9e78d2..ea8aabc 100755 --- a/listversioned/listversioned.rb +++ b/listversioned/listversioned.rb @@ -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