如何让 CruiseControl.NET 与 Mercurial 一起工作:“源代码控制失败 (GetModifications)”

发布于 2024-10-05 22:39:20 字数 2465 浏览 3 评论 0原文

我正在尝试设置 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>

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

[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

该错误大概是由 < 中未加引号的尖括号引起的code>--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

I'm trying to set up CruiseControl.NET 1.5.7256.1 for automatic builds. My project is stored in Mercurial, and I'm using the following 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>

But when I force a build, I get this error:

[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

The error is presumably caused by the unquoted angle brackets in the --template parameter, but how can I make CC.NET put quotes around that parameter?

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

Here's 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水水月牙 2024-10-12 22:39:20

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

project\core\sourcecontrol\Mercurial\Mercurial.cs 中,模板的使用方式如下:

buffer.AddArgument("--template", HistoryTemplate)

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

string.Format("{0}{1}{2}", arg, separator, StringUtil.AutoDoubleQuoteString(value))

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

更新1

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

更新2

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

I'm successfully using CruiseControl.NET 1.5.7256.1 with Mercurial installed from this msi, using full path of hg.exe as the executable value.

In project\core\sourcecontrol\Mercurial\Mercurial.cs the template is used like this:

buffer.AddArgument("--template", HistoryTemplate)

and will be formatted for the command line like this:

string.Format("{0}{1}{2}", arg, separator, StringUtil.AutoDoubleQuoteString(value))

where the separator is " ", and AutoDoubleQuoteString will quote the template, so this can't be the cause of the error.

UPDATE 1

Actually, AutoDoubleQuoteString should quote the template, but in the current version doesn't do it. Also, even if the build succeeds when using hg.exe, running the actual command line in a command prompt returns the same error.

UPDATE 2

CruiseControl.NET 1.6.7981.1 was just released (see release notes), and since the template is now passed as a file, it works just fine (at least on my PC).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文