The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20130324

how to parse multiple cruisecontrol log files and put all svn commit comments into a single text file...

...to serve as a summary list of changes.

say you have a folder with cruisecontrol log files, like this:
...
log20130204150005Lbuild.1403.xml  log20130321154941Lbuild.1611.xml
log20130205085601Lbuild.1404.xml  log20130322094540Lbuild.1612.xml
log20130205101742Lbuild.1405.xml  log20130322132805Lbuild.1613.xml
log20130205102821Lbuild.1406.xml  log20130322133911Lbuild.1614.xml
log20130205113917Lbuild.1407.xml  log20130322152039Lbuild.1615.xml
log20130205120959Lbuild.1408.xml  log20130322153132Lbuild.1616.xml
...


and you want to make a summary of changes, based on comments you've written when you've committed code to svn.

a log file's xml looks like this:
<cruisecontrol>
 <modifications>
  <modification type="svn">
   <file action="modified">
    <revision>3481</revision>
    <filename>/trunk/build_scripts/build.properties</filename>
   </file>
   <date>2012-12-11T12:21:15</date>
   <user>nick</user>
   <comment>removing spring</comment>
   <revision>3481</revision>
  </modification>
  ...


just run the following code in a terminal, in the directory where your log files are:
xpath -q -e /cruisecontrol/modifications/modification/comment log* > comments.txt

NOTE: /cruisecontrol/modifications/modification/comment is the XPATH to the comment tag in the xml file.


comments.txt will look something like this:
<comment>converted iterator loops to enhanced for loops, added generics</comment>
<comment />
<comment />
<comment>forbid users to create users with usernames that start with "admin"</comment>
<comment>added new labels</comment>
<comment>removing spring</comment>

...


No comments:

Post a Comment