I am having trouble printing the list of changes. Everytime I run my script and check the value, it is blank.

postcommithook.bat
set REPOS=%1
set REV=%2
set TXN_NAME=%3
set LF = ^

SET ThisScriptsDirectory=%~dp0

set svnlook = "C:\Program Files\TortoiseSVN\bin\"

for /f "tokens=*" %%a in ('%svnlook% svnlook author -r %REV% %REPOS%') do set AUTH_NAME=%%a

setlocal enabledelayedexpansion

set MSG = for /f %%i in ('svnlook changed -r %REV% %REPOS%') do (
SET "VAR=!VAR!!LF%%i"
SET "PAR=!PAR!^^!LF!!LF!%%i"
)
set DIRS_CHANGED = !VAR!
endlocal

SET PowerShellScriptPath=%ThisScriptsDirectory%emailer.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%' '%REPOS%' '%REV%' '%TXN_NAME%' '%AUTH_NAME%' '%DIRS_CHANGED%'";

I understand I am doing a mistake somewhere in the loop where I am calling the changes function. How would I be able to get the list of changed directories and pass it to the mailer script?

Thanks in advance

有帮助吗?

解决方案

Answering my own question here: I have removed the loop where the command 'svn changed' is done. Instead I store the output in a separate file and then commence processing it via a powershell/vbscript file for an e-mail to be generated.

Replaced the below:

svnlook changed %REPOS% -r %REV% > %ThisScriptsDirectory%tmp_log.txt

Instead of

setlocal enabledelayedexpansion
set MSG = for /f %%i in ('svnlook changed -r %REV% %REPOS%') do (
SET "VAR=!VAR!!LF%%i"
SET "PAR=!PAR!^^!LF!!LF!%%i"
)
set DIRS_CHANGED = !VAR!
endlocal

Thanks, Venkat.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top