Format Svn Log Output
I Would Like to Fetch the Log Message for a File Committed to Svn. I'm Using the Following Command Currently: Svn --Non-Interactive Log "Myfile. C" | Sed -E...
I would like to fetch the log message for a file committed to svn. I'm using the following command currently:
svn --non-interactive log "myfile.c" | sed -e "s/[\-]//g"'
The output is :
r42153 | sam | 2012-03-02 14:51:53 -0800 (Fri, 02 Mar 2012) | 1 line
Update to code.
I would like to get rid of the first line "r42153 | sam |...." and output just the log message.
How can I do this?
4 Answers
use | grep -v "what you don't want to include" to leave out the lines you don't want. However, trying to leave out anything with a \n just leaves out everything, so don't do that.
You can throw away useful lines from your commit messages while using grep. SVN provides propget command out of the box:
use
$ svn propget svn:log --revprop -r R [TARGET]
to get commit message
or
$ svn propget svn:log --revprop -r R [TARGET] --xml
to get it in XML.
TARGET is path to repository and can be omitted id you are in working copy.
You can use | sed -e ':a;N;$!ba;s/-\+\(\n[^\n]*\n\)\?//g' to remove all "---" with treir next lines.
As long as you are logging a single revision, you can use
svn log -rXXXX | tail -n+4 | head -n-1
to get rid of everything except the message.