davidkeaveny / svnrevisionlabeller

Automatically exported from code.google.com/p/svnrevisionlabeller
0 stars 0 forks source link

Unable to use dynamic properties in labeller block #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It is not possible to use dynamic properties within the configuration in 
1.5.

Not suprising really as you do not officially support 1.5 :)

I would like to be able to do this so I can specify a tag to check out and 
build which will be at a specific version number. Currently this is not 
possible.

Example:

    <labeller type="svnRevisionLabeller">
            <pattern>{revision}</pattern>
            <incrementOnFailure>false</incrementOnFailure>

<resetBuildAfterVersionChange>false</resetBuildAfterVersionChange>
            <url>https://server:8443/svn/main/projects/somproject/
$[Branch|trunk]</url>
            <executable>"C:\PROGRAM FILES\Collabnet\Subversion 
Client\svn.exe"</executable>
            <username>username</username>
            <password>password</password>
        </labeller>

Currently the $[Branch|trunk] doesn't work. (labeller does not throw an 
error it simply cannot get the information so reports 0).

Original issue reported on code.google.com by Krys...@gmail.com on 16 Mar 2010 at 4:43

GoogleCodeExporter commented 9 years ago
Hi sorry wasn't clear how I could change this into A RFE.

Original comment by Krys...@gmail.com on 16 Mar 2010 at 4:48

GoogleCodeExporter commented 9 years ago
Plus one for this request.  We typically name hotfix branches according to the 
date on which they were created, and when it comes time to build a hotfix 
branch using CruiseControl.NET we'd like the hotfix name we supply via the 
CCNET dashboard to be used when the labeller is retrieving a revision number.

    <labeller type="svnRevisionLabeller">
            <pattern>r{revision}</pattern>
            <url>svn://ourserver/branches/$[HotfixBranchName]/src/sln/sln_Master</url>
        </labeller>

Original comment by objec...@gmail.com on 15 Sep 2010 at 9:35

GoogleCodeExporter commented 9 years ago
Here's a fixed .cs file for anyone that wants to recompile. It has both support 
for the dynamic properties, and also fixed the rebuild bug.

sample working after fix:

<labeller type="svnRevisionLabeller">
                <major>2</major>
                <minor>0</minor>
                <build>2</build>
                <pattern>{major}.{minor}.{build}.{revision}.{rebuild}B</pattern>
                <incrementOnFailure>false</incrementOnFailure>
                <executable>C:\Program Files\SlikSvn\bin\svn.exe</executable>
                <url>svn://sample/</url>
                <dynamicValues>
                    <directValue parameter="MajorVersion" property="major" />
                    <directValue parameter="MinorVersion" property="minor" />
                    <directValue parameter="SubVersion" property="build" />
                </dynamicValues>
            </labeller>
<parameters>
                <numericParameter name="MajorVersion">
                    <description>Major Version Label</description>
                    <minimum>2</minimum>
                    <default>2</default>
                </numericParameter>
                <numericParameter name="MinorVersion">
                    <description>Minor Version Label</description>
                    <minimum>0</minimum>
                    <default>0</default>
                </numericParameter>
                <numericParameter name="SubVersion">
                    <description>Sub Version Label</description>
                    <minimum>0</minimum>
                    <default>3</default>
                </numericParameter>
                <selectParameter name="targetDeployment">
                    <description>Targeted Deployment Server</description>
                    <allowedValues>
                        <value name="nightly">Nightly</value>
                        <value name="dev">Development</value>
                    </allowedValues>
                </selectParameter>
            </parameters>

Original comment by seiggy2k on 10 Nov 2010 at 9:12

Attachments:

GoogleCodeExporter commented 9 years ago
here's the patch file for those that prefer using svn patch

Original comment by seiggy2k on 10 Nov 2010 at 9:38

Attachments:

GoogleCodeExporter commented 9 years ago
We had a problem with version 2.0.x.x where our rebuild numbers stopped 
resetting after a successful build, once we upgraded to CC.NET 1.5.  I figured 
a new version of the labeler would solve it and then I found this issue and 
comment #3 that says it fixes the rebuild reset issue.  But after pulling, 
patching, building and debugging I found that our problem was that the regex is 
case sensitive and all of our patterns are like 
'{Major}.{Minor}.{Revision}.{Rebuild}'.  So the regex wouldn't match 
(match.success = false) and then trying to access the group named 'major' would 
result in 'System.FormatException: Input string was not in a correct format.' 
because accessing an non-existent group's value returns string.Empty and 
Convert.ToInt32 barfs on that.

I could have solved the problem by just changing our ccnet.config file pattern 
elements, but you'll notice our pattern doesn't contain a {build} element, so 
we would have gotten the same error on the line that accesses that one.  So I 
changed the way that the parsing works a little bit to be more tolerant of 
casing of the pattern and missing pattern elements.  Attached are patch and 
full source files that include the patches provided by seiggy2k in comment #4, 
plus the changes I describe above.

Original comment by dgorto...@gmail.com on 18 Nov 2010 at 4:51

Attachments: