如何让CruiseControl.NET与Mercurial一起使用:"源控制失败(GetModifications)"

Jes*_*rew 7 cruisecontrol.net mercurial continuous-integration

我正在尝试为自动构建设置CruiseControl.NET 1.5.7256.1.我的项目存储在Mercurial中,我使用以下内容ccnet.config:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
    <project name="Slider" webURL="http://localhost/ccnet">
        <triggers>
            <intervalTrigger seconds="3600" />
        </triggers>
        <sourcecontrol type="hg" autoGetSource="true">
            <executable>C:\Python26\Scripts\hg.bat</executable>
            <repo>c:\repos\slider</repo>
            <workingDirectory>c:\ccnet\slider</workingDirectory>
        </sourcecontrol>
        <tasks>
            <msbuild>
                <executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe</executable>
                <workingDirectory>c:\ccnet\slider</workingDirectory>
                <projectFile>Slider.sln</projectFile>
                <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
                <targets>Slider</targets>
                <timeout>900</timeout>
                <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
            </msbuild>
        </tasks>
    </project>
</cruisecontrol>
Run Code Online (Sandbox Code Playgroud)

但是当我强制构建时,我收到此错误:

[Slider:WARN] Source control failure (GetModifications): Source control operation failed: < was unexpected at this time.
. Process command: C:\Python26\Scripts\hg.bat log -r 0:123 --template <modification><node>{node|short}</node><author>{author|user}</author><date>{date|rfc822date}</date><desc>{desc|escape}</desc><rev>{rev}</rev><email>{author|email|obfuscate}</email><files>{files}</files></modification> --noninteractive
[Slider:INFO] Integration complete: Exception - 12/2/2010 1:19:08 PM
Run Code Online (Sandbox Code Playgroud)

该错误可能是由--template参数中的未引用尖括号引起的,但是如何让CC.NET在该参数周围加上引号呢?

===============

这是hg.bat:

@echo off
rem Windows Driver script for Mercurial

setlocal
set HG=%~f0

rem Use a full path to Python (relative to this script) as the standard Python
rem install does not put python.exe on the PATH...
rem %~dp0 is the directory of this script

%~dp0..\python "%~dp0hg" %*
endlocal
Run Code Online (Sandbox Code Playgroud)

ale*_*rul 3

我成功使用 CruiseControl.NET 1.5.7256.1 并从此msi安装了 Mercurial ,并使用 的完整路径hg.exe作为executable值。

project\core\sourcecontrol\Mercurial\Mercurial.cs模板中使用如下:

buffer.AddArgument("--template", HistoryTemplate)
Run Code Online (Sandbox Code Playgroud)

并将针对命令行进行格式化,如下所示:

string.Format("{0}{1}{2}", arg, separator, StringUtil.AutoDoubleQuoteString(value))
Run Code Online (Sandbox Code Playgroud)

其中分隔符是" ",AutoDoubleQuoteString并将引用模板,因此这不可能是错误的原因。

更新1

实际上,AutoDoubleQuoteString 应该引用模板,但在当前版本中并没有这样做。此外,即使使用时构建成功hg.exe,在命令提示符中运行实际命令行也会返回相同的错误。

更新2

CruiseControl.NET 1.6.7981.1刚刚发布(请参阅发行说明),并且由于模板现在作为文件传递,因此它工作得很好(至少在我的电脑上)。