繁体   English   中英

Windows上的Perl中的SVN预提交挂钩

[英]SVN Pre-Commit Hook in Perl on Windows

我正在编写Perl脚本以在Windows计算机上进行SVN预提交检查,并且我使用VisualSVN Server。

这是代码:

预commit.bat

C:\Perl\bin\perl.exe D:\Repositories\iCP\hooks\pre-commit.pl %1 %2
exit %ERRORLEVEL%

pre-commit.pl

#!/usr/bin/perl

use strict;
use warnings;

my $repos = $ARGV[0];
my $txn = $ARGV[1];

my $svnlook = "D:\\svnlook.exe";
my $hooks = "D:\\Repositories\\iCP\\hooks";

if(system("$svnlook log -t $txn $repos >$hooks\\res.txt"))
{
  die "Unable to finish system(): $!\n";
}

....

基本上,我希望将“ svnlook日志”结果重定向到res.txt,然后可以从该文件读取。

但是,当我从TortoiseSVN提交时,perl脚本因“ 无法完成System():不适当的IO控制操作 ”而死亡,我不知道出了什么问题。

感谢您的帮助。

最有可能是qoute问题。 Perl使用\\作为转义序列,因此当您包含带有double \\的变量时,它将转换为简单\\。

尝试这个:

my $svnlook = "D:\\\\svnlook.exe";
my $hooks = "D:\\\\Repositories\\\\iCP\\\\hooks";

if(system("$svnlook log -t $txn $repos >$hooks\\res.txt"))
{
  die "Unable to finish system(): $!\n";
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM