1 package hudson.scm; 2 3 import hudson.model.AbstractBuild; 4 import hudson.scm.SubversionChangeLogSet.LogEntry; 5 import hudson.scm.SubversionChangeLogSet.Path; 6 import hudson.util.IOException2; 7 import org.apache.commons.digester.Digester; 8 import org.xml.sax.SAXException ; 9 10 import java.io.File ; 11 import java.io.IOException ; 12 import java.util.ArrayList ; 13 14 19 public class SubversionChangeLogParser extends ChangeLogParser { 20 public SubversionChangeLogSet parse(AbstractBuild build, File changelogFile) throws IOException , SAXException { 21 23 Digester digester = new Digester(); 24 ArrayList <LogEntry> r = new ArrayList <LogEntry>(); 25 digester.push(r); 26 27 digester.addObjectCreate("*/logentry", LogEntry.class); 28 digester.addSetProperties("*/logentry"); 29 digester.addBeanPropertySetter("*/logentry/author","user"); 30 digester.addBeanPropertySetter("*/logentry/date"); 31 digester.addBeanPropertySetter("*/logentry/msg"); 32 digester.addSetNext("*/logentry","add"); 33 34 digester.addObjectCreate("*/logentry/paths/path", Path.class); 35 digester.addSetProperties("*/logentry/paths/path"); 36 digester.addBeanPropertySetter("*/logentry/paths/path","value"); 37 digester.addSetNext("*/logentry/paths/path","addPath"); 38 39 try { 40 digester.parse(changelogFile); 41 } catch (IOException e) { 42 throw new IOException2("Failed to parse "+changelogFile,e); 43 } catch (SAXException e) { 44 throw new IOException2("Failed to parse "+changelogFile,e); 45 } 46 47 return new SubversionChangeLogSet(build,r); 48 } 49 50 } 51 | Popular Tags |