TOPIC: Processing Subversion Logs
#1022
Processing Subversion Logs 2 Years, 10 Months ago
I usually include the exe changes in the change log for Suneido releases.

Subversion produces entries like:

Code:

------------------------------------------------------------------------
r65 | amckinlay | 2007-10-07 14:51:18 -0600 (Sun, 07 Oct 2007) | 1 line
Changed paths:
   M /trunk/rebuildgui.cpp

adding check_start
------------------------------------------------------------------------
r64 | amckinlay | 2007-10-07 14:49:05 -0600 (Sun, 07 Oct 2007) | 1 line
Changed paths:
   M /trunk/msgloop.cpp

added compact_exit
------------------------------------------------------------------------



I prefer a more compact format like:

Code:

rebuildgui.cpp - adding check_start
msgloop.cpp - adding compact_exit



I wrote a quick function to convert:

Code:

log = Object()
RunPiped('svn log -v https://suneido.svn.sourceforge.net/svnroot/suneido')
    { |p|
    while false isnt line = p.Readline()
        {
        if line =~ '^-+$'
            continue
        if line.Prefix?('   A')
            log.Add(line.AfterFirst('/trunk/') $ ' - new')
        if line.Prefix?('   M')
            {
            files = Object()
            do
                files.Add(line.AfterFirst('/trunk/'))
                while ((line = p.Readline()).Prefix?('   M'))
            AssertEq(line, '')
            comment = p.Readline()
            log.Add(files.Join(', ') $ ' - ' $ comment)
            }
        }
    }
Print(log.Reverse().Join('n'))



Notice the use of the new RunPiped. (I could have just redirected the output of svn to a text file and processed that.)

The reverse at the end is to switch from latest first to oldest first.
 
 
andrew