| 序号 |
评论者 |
共有评论 24 【论坛浏览】 【发表评论】 |
评论时间 |
|
| 1 |
go2cxg |
说明要注意的一个问题 在这里系统没有默认的USER这个变量
你需要自己提取出来
我的提取方法是
svnlook info %REPOS% > D:\TempFIle\INFO_%RD%.txt
这个目的是 获取更新的一些信息:
列表如下:
Xiaoguang.Chen(执行提交操作的用户名)
2008-07-28 16:56:05 +0800 (星期一, 28 七月 2008)
45
test for The Subversion Scmlife~Final version(LOG 提交的日志信息)
息输入到了 D:\TempFIle\INFO_%RD%.txt 文件当中
然后我用如下的组合拳获取到了USER这个变量 哈哈
sed -e "1p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set user=%%i
在POST-Commit这个HOOK里面没有默认带USER这个变量 只能通过SVNLOOK这个命令查看
REPO的信息才能看到,svnlook info %repo% 是查看最后一次更新的信息
只有在POST-LOCK 和POST-UNLOOK这两个HOOKS里面才会传入USER这个变量。
不知道有没有回答你的问题 |
2008/7/30 09:45 |
|
| 2 |
go2cxg |
再把个人优化过的POST-COMMIT.bat文件发过来,修改下用即可 @echo on
set REPOS=%1
set REV=%2
set RD=%RANDOM%
svnlook info %REPOS% > D:\TempFIle\INFO_%RD%.txt
svnlook changed %REPOS% > D:\TempFIle\CHG_%RD%.txt
sed -e "1p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set user=%%i
sed -e "2p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set dtime=%%i
sed -e "4p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set LOG_MSG=%%i
echo Dear %user% : >> D:\TempFIle\MSG_%RD%.txt
echo The Current Version After Commit :%REV% >> D:\TempFIle\MSG_%RD%.txt
echo Commit time :%dtime% >> D:\TempFIle\MSG_%RD%.txt
echo Commit LOg :%LOG_MSG% >> D:\TempFIle\MSG_%RD%.txt
echo The Commit COntent : >> D:\TempFIle\MSG_%RD%.txt
echo. >> D:\TempFIle\MSG_%RD%.txt
type D:\TempFIle\CHG_%RD%.txt >> D:\TempFIle\MSG_%RD%.txt
type D:\TempFIle\scm.txt >> D:\TempFIle\MSG_%RD%.txt
blat D:\TempFIle\MSG_%RD%.txt -to %user%@*.*.com -base64 -charset Gb2312 -subject "Subversion_Notes Commit~User:%user% Version:%REV%" -server smtp.*.*.com -u scm -pw ****** -f scm@corp.**.com
exit 0
D:\TempFIle\scm.txt 是SCM Team的一些信息,
如下
================================================
SCM Team
If you Have Any Questions,Please Contact Us:
================================================
将会收到如下类似的邮件:
Dear ****:
The Current Version After Commit :192
Commit time :2008-07-28
Commit LOg :test
The Commit COntent :
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/IApplicationHost.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/IOutputHandler.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PostCommitHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PostLockHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PostUnlockHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PreCommitHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PreLockHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/PreUnlockHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/StartCommitHook.cs
D trunk/CaptainHookSource/Backup/CaptainHook.Interfaces/SubversionHook.cs
U means Update file
_u means the properity of the file is updated
D means the file is deleted
A means the file is Added
================================================
SCM Team Of **
If you Have Any Questions,Please Contact Us:
Best Wish~
================================================
当然邮件内容可以自己设计~呵呵 |
2008/7/30 10:05 |
|
| 3 |
phadams |
: 1:: linux下有没有类似的工具呢? |
2008/7/30 19:37 |
|
| 4 |
go2cxg |
linux下面会更简单
因为linux下面有自己的邮件工具
不要想windows下面那么辛苦了
而且用shell写Hooks比用windows的批处理要灵活得许多 |
2008/7/31 10:30 |
|
| 5 |
ice_deng |
谢谢你啦!
我们公司的SVN服务器也是在WIN下面的,下载了,试试看吧,有问题再向LZ请教啦!
没试用前,有个问题请教:
你这里讲的是邮件通知,请问如果要使用RTX(相当于内部QQ)通知,是不是将邮件必为RTX号就可以了呢? |
2008/8/17 23:02 |
|
| 6 |
lpm |
sed -e "4p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set LOG_MSG=%%i
楼主,在使用过程中发现如果LOG有多行时,使用上面的语句只会把LOG的最后一行显示在邮件中,我修改为:
sed -e "4,$p" -n D:\TempFIle\INFO_%RD%.txt > D:\TempFIle\temp.txt&&for /f %%i in (D:\TempFIle\temp.txt) do set LOG_MSG=%%i
同时
echo Commit LOg :%LOG_MSG% >> D:\TempFIle\MSG_%RD%.txt
改为
echo Commit LOg : >> D:\TempFIle\MSG_%RD%.txt
type D:\TempFIle\temp.txt >> D:\TempFIle\MSG_%RD%.txt
就OK 了。 |
2008/8/19 16:06 |
|
| 7 |
go2cxg |
多谢 哈哈 我的方法比较笨哈 |
2008/8/20 08:37 |
|
| 8 |
qunsheng_83 |
先收藏起来,再慢慢学习。
谢谢楼主了 |
2008/8/20 09:51 |
|
| 9 |
achinaren |
很不错,很实用.
谢谢楼主了 |
2008/9/11 17:13 |
|
| 10 |
snowry6 |
怎么配置啊,看不懂啊,我是新手!求助 |
2008/10/8 11:05 |
共有评论数 24 每页显示 10
|