How to get svn transfer message in bat window?

I need to get the SVN commit message in poker commit on Windows, so I do this:

FOR /F "tokens=*" %%a in ('"svnlook log %1 -r %2"') do @SET MSG=%%a

      

I am testing it, it is ok for most cases.

but when I enter multiple lines in the SVN commit message, the command can only get the last line of the commit message, I think it is caused by a Windows batch file limitation.

How do I get all the commit message of a bat variable?

+2


source to share


2 answers


FOR /F

works line by line at the input. Try changing @SET MSG=%%a

to @SET MSG=!MSG! %%a

.



+1


source


Depending on the type or format of the commit messages, it may be preferable to store newlines as well; it can be accomplished with this:

set newline=^


setlocal ENABLEDELAYEDEXPANSION

      

Note that the newline requires blank lines, so ENABLEDELAYEDEXPANSION

(once, somewhere before using !newline!

).



Now you can use this to concatenate messages (skipping blank lines, by the way) with a newline, and then trim the first newline:

FOR /F "tokens=*" %%a in ('"svnlook log %1 -r %2"') do @SET MSG=!MSG!!newline!%%a
@SET MSG=!MSG:~1!

      

+2


source







All Articles