充分利用通过svnlook的Windows批处理日志消息 [英] Getting log message from svnlook via windows batch
问题描述
我尝试prepare我的svn库一个post-commit钩子。因此,我需要从最后的日志信息提交,我用命令获得svnlook的日志-r%REV%REPOS%%
。灌装片段与适当的PARAMS我得到以下multline日志消息:
此
是
我的
交易。
这工作得很好至今。现在我把这个.bat文件:
@ECHO OFFREM只是用于测试目的...
SET REPOS = C:\\回购
SET REV = 40FOR / F %% i的('svnlook的日志-r%REV%REPOS%%)做SET VAR = %%我ECHO%VAR%
当我执行该脚本只有最后一行交易。
是呼应。 for循环是的,我想一个片段,它会读取svnlook的输出到%VAR%
。
我的做法是在一个变量,这是我传递给其他的EXE文件作为参数来获取日志消息。但它不会工作。我不知道如何正确使用循环。
日志消息应该给予另一EXE文件作为参数。</ P>
我修改剧本以下(@thx PA)。
@ECHO OFF
SETLOCAL enabledelayedexpansionSET REPOS = C:\\回购
SET REV = 40SET MSG =
FOR / F %% i的('svnlook的日志-r%REV%REPOS%%)做SET VAR =!VAR! %%一世
ECHO!VAR!
输出是现在这是我的事务。
但断行都走了,但我需要做进一步处理。
你还想换行符,你的串联线路时,可以将它们添加。
@ECHO OFF
SETLOCAL enabledelayedexpansion
设置LF = ^
REM **两个空行是必要的SET REPOS = C:\\用户\\ CH.ROSESOFT \\下载\\ T3 \\回购
SET REV = 40SET MSG =
FOR / F %% i的('svnlook的日志-r%REV%REPOS%%')做(
SETVAR =!VAR!LF!%%我
SETPAR =!PAR!^^!LF !! LF!%%我
)
ECHO!VAR!
myProgram.exe!相提并论!
I try to prepare a post-commit hook for my svn repository. Therefore i need the log message from the last commit which I get with the command svnlook log -r %REV% %REPOS%
. Filling the snippet with the appropriate params I get the following multline log message:
This
is
my
transaction.
This works well so far. Now I put this in a .bat file:
@ECHO OFF
REM just for testing purpose...
SET REPOS=C:\repo
SET REV=40
FOR /F %%i in ('svnlook log -r %REV% %REPOS%') do SET VAR=%%i
ECHO %VAR%
When I execute the script only the last line transaction.
is echoed. The for-loop is a snippet from which I thought, it would read the svnlook output into %var%
.
My approach is to get the log message in a variable, which I pass to another exe-file as parameter. But it won't work. I don't know how to properly use the loop.
The log message should given to another exe-file as an parameter.
I modified the script to the following (@thx PA.)
@ECHO OFF
setlocal enabledelayedexpansion
SET REPOS=C:\repo
SET REV=40
SET MSG=
FOR /F %%i in ('svnlook log -r %REV% %REPOS%') do SET VAR=!VAR! %%i
ECHO !VAR!
The output is now This is my transaction.
But the linebreak are gone but I need the for further processing.
As you want also the linebreaks, you can add them when concatenating the lines.
@ECHO OFF
setlocal enabledelayedexpansion
set LF=^
rem ** The two empty lines are NECESSARY
SET REPOS=C:\Users\CH.ROSESOFT\Downloads\t3\repo
SET REV=40
SET MSG=
FOR /F %%i in ('svnlook log -r %REV% %REPOS%') do (
SET "VAR=!VAR!!LF!%%i"
SET "PAR=!PAR!^^!LF!!LF!%%i"
)
ECHO !VAR!
myProgram.exe !par!
这篇关于充分利用通过svnlook的Windows批处理日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!