3

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 4

1

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.

1
  • Thanks @Dez. I forgot about grep. I ended up using grep -v "| [0-9]\+ line[s]\?$"
    – smokinguns
    Mar 10, 2012 at 0:55
2

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.

1
  • This should be the accepted answer :)
    – Sebi
    Aug 21, 2015 at 12:17
0

You can use | sed -e ':a;N;$!ba;s/-\+\(\n[^\n]*\n\)\?//g' to remove all "---" with treir next lines.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .