7

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
3
  • what does the contents of hg.bat look like?
    – brianc
    Dec 5, 2010 at 2:27
  • It calls the Python interpreter to run Hg. IIRC it was created by the Python package installer. I can post the contents on Monday. Dec 5, 2010 at 5:36
  • 1
    Well, I ended up switching to TeamCity, which works just fine with Hg and is also easy to configure. It'd still be nice to know what was going wrong with CC.NET. Dec 10, 2010 at 19:26

1 Answer 1

3

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).

1
  • Ah, hmm. Must be the way I have Hg installed, then. Dec 16, 2010 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.