I am using Subversion 1.6.6 on Ubuntu 10.04, running a bash shell. I would like to insert a carriage return, or linefeed, or newline into my commit message so that when reading the log, the comments are formatted appropriately. It works fine when I use the system editor, or specify a file for the commit comment, but what I really want is to be able to do something like the following:

svn ci -m "This is the first line\nThis is the second line"

and have the comment presented as:

This is the first line
This is the second line

My example does not work, it produces output:

This is the first line\nThis is the second line

So, is there a way to do this? If so, how?

link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

Try this:

svn ci -m $'This is the first line\nThis is the second line'
link|improve this answer
That appears to have the same problem, with the subversion log not interpreting the "\n". – Paul Kroon Jun 7 '10 at 15:00
actually, the subversion log worked fine with Dennis' solution. – Scott Jun 7 '10 at 15:10
Interesting, must be because I'm still running 9.10. I'm glad the simpler command worked! – Paul Kroon Jun 7 '10 at 15:19
@Paul: This is a shell feature. It should work in Ubuntu 9.10. Are you sure you're trying it with the dollar sign and single quotes? As a test, at the shell prompt, enter echo $'one\ntwo' it should give you the same output as echo -e 'one\ntwo' which should be "one" on one line and "two" on the next. Double quotes would also work for the echo -e version. – Dennis Williamson Jun 7 '10 at 17:20
feedback

Just hit enter when you're typing it, instead of the \n. The prompt will turn to ">" and you can continue typing.

This is a shell question, not a Subversion question.

link|improve this answer
Thanks for the quick response, and sorry for the mis classification. My goal is to put this into a bash script, so if there is any to do this without hitting enter that would help. – Scott Jun 7 '10 at 14:51
svn ci -m "this is a test --- next line --- > just a test" Figures I'd have newline problems in the comment about a newline problem :). It'll look like that with the ">" on the next line like Andy said. You can do the same thing in a script file (just tested it with bash). – Paul Kroon Jun 7 '10 at 15:00
Paul - your command di not work for me. Dennis' command did work. – Scott Jun 7 '10 at 15:12
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.