开发者

How to concatenate all commit messages from subversion into one text file with no metadata?

开发者 https://www.devze.com 2023-01-02 21:29 出处:网络
I would like to take all the commit messages in my subversion log and just concatenate them into one text file, preferably using the svn command line on windows.

I would like to take all the commit messages in my subversion log and just concatenate them into one text file, preferably using the svn command line on windows.

Each commit message has this format:

- r1 message

- r1 message

- r1 message

What 开发者_StackOverflow中文版I would like is something like:

- r1 message

- r1 message

- r2 message

- r2 message

- r3 message

[...]

- r1000 message

Update

I thought the above was clear, but what I don't want in the log is this type of info:

r2130 | user| 2010-03-19 10:36:13 -0400 (Fri, 19 Mar 2010) | 1 line

No meta data, I simply want the commit messages.


You can use the --xml parameter of the svn log command, which set the output format to xml, and than easily parse it with some scripting language to produce the text file you need.
In python something like:

from xml.dom.minidom import parse
xml = parse("log.xml")
entries = xml.getElementsByTagName("logentry")
for e in entries:
    rev = e.getAttribute("revision")
    msg = e.getElementsByTagName("msg")[0].firstChild.nodeValue
    print "-r" + rev + " " + msg

Save it as parseLog.py, and then simply launch

svn log --xml > log.xml
python parseLog.py > revisions.txt


As Davide Gualano suggested you can use the --xml command to produce a output which can be parsed. Use an arbitrary xslt processor and a xslt file to produce the output you need. See svn2cl for an example.


Withn Tortoise SVN you can right-click, select Tortoise/Show Log. Select all logs and paste them in a file.


from the windows command line, not sure how to get rid of the lines of -------

svn log - q > svn.log


If you're a Java developer, you can use SVNKit to write exactly the kind of Subversion extract program you wish.

Otherwise, as others have answered, you can take the log output and manually manipulate it.

0

精彩评论

暂无评论...
验证码 换一张
取 消