1

我正在创建一个简单的 'post-commit' svn 批处理脚本,它将在我们的开发团队成员提交构建时运行。此批处理文件将结果输出发送到松弛服务,该服务将其吐出到我们的团队频道。

这一切都没有任何问题,但我想加入一些定制的格式,比如换行和粗体文本。目前读起来有点难。能够突破新线是我追求的主要目标。我做了很多搜索,但似乎找不到正确的答案。

这个事情谁有经验?

这是我当前脚本的内容:

set one=%1
set rev=%2
set changes=svnlook changed %one% -r %rev%
set whatchanged=nothing


for /f "delims=" %%a in ('%changes%') do ( set whatchanged=%%a )


for /f "delims=-" %%i in ('%rev%') do (
SET rev=%%i
)


for /f "delims=" %%g in ('svnlook log %one% -r %rev%') do (
 SET comlog=%%g
)

for /f "delims=" %%i in ('svnlook author %one% -r %rev%') do (
 SET "author=%%i"
)

for /f "delims=" %%i in ('svnlook changed %one% -r %rev%') do (
 SET changed=%%i
)


powershell -Command "& Invoke-RestMethod -Uri 'our URL with a unique token goes here' -Method Post -Body (ConvertTo-Json @{text='%author% %rev% %one% %comlog% %whatchanged%'})"


REM  All checks passed, so allow the commit.
exit 0

当前的输出如下所示:

liam.mcdonald 171 D:\Repositories\company

这是另一个:

U 测试/新建文本 Document.txt

4

0 回答 0