[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How should I properly escape special characters in commit message?

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-12-10 18:36:25 CET

On Dec 10, 2007, at 11:06, Geoffrey Hoffman wrote:

> On Dec 9, 2007, at 9:03 AM, melmack melmack wrote:
>
>> I've one problem with escaping special characters (quotes and
>> backslashes) in commit message. To explain it better I'll show 2
>> examples (both in Win32 cmd.exe shell):
>>
>> (1) svn commit -m "foo\\\"bar"
>>
>> Comment is saved to svn as foo\"bar
>>
>> (2) svn commit -m "foo\\\\bar"
>>
>> Comment is saved to svn as foo\\\\bar
>>
>> What is the reason of the fact that in example (1) svn interpreter
>> collapses \\ to \ and \" to " (as in regular expressions syntax)
>> and in example (2) nothing is collapsed? I thought that example(2)
>> should have saved \\ as comment. Why was the result different? So
>> how should I escape the comments properly? Is there an algorithm
>> to do this?
>> My temporary solution to solve this problem is putting comment to
>> file and call svn vommit with -F option but this is inefficient
>> way, so any help will be appreciated...
>
> -m "This message 'should work' when you commit"
> -m 'This message "should work" when you commit'
> -m "This message `should work` when you commit"
>
> (This is on Mac OS X Terminal)

None of that demonstrates escaping; you're just choosing characters
which don't have to be escaped.

I imagine escaping is particular to whatever shell you're using. On
Mac OS X, you're probably using bash, or perhaps tcsh. On Windows,
the OP is using I have no idea what, and I have no idea how it
behaves with regard to escaping. But there should be some Windows
shell / DOS prompt reference that could be looked up. In any case,
Subversion isn't doing any of it itself. It's all in the shell.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Dec 10 18:37:02 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.