main-config.xml / transformation-pattern

I'm attempting to run multiple replaces for different patterns.  The DTD states that you can have multiple transformation-patterns.  But the behavior I am seeing is that only the first is being executed.

Is this a bug?

7 comments
Comment actions Permalink

Here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<server rootURL="http://ambraproject.org/teamcity">
  <db-compact>
    <scheduler hour="3" minute="0" />
  </db-compact>
  <auth-type>
    <login-module />
    <login-description />
    <guest-login allowed="false" guest-username="guest" />
    <free-registration allowed="true" />
  </auth-type>
  <artifacts maxArtifactSize="300000000" />
  <comment-transformation>
    <transformation-pattern search="(.+)#([0-9]+)(.?+)" replace="$1&lt;a title=&quot;Click to open this issue&quot;
href=&quot;/trac/ticket/$2&quot;&gt;#$2&lt;/a&gt;$3" description="Trac link" />
<transformation-pattern search="(.+)r([0-9]+)(.?+)" replace="$1&lt;a title=&quot;Click to open this changeset&quot;
href=&quot;/trac/changeset/$2&quot;&gt;r$2&lt;/a&gt;$3"
description="Subversion link" />
  </comment-transformation>
  <report-tab title="Code Coverage" basePath="coverage.zip" />
  <report-tab title="JavaDoc" basePath="javadoc.zip" />
</server>

0
Comment actions Permalink

What version of TeamCity do you use?

0
Comment actions Permalink

Version 4.5 (build 8944)

0
Comment actions Permalink

Joe,

It's not a bug, you can have several patterns, but in each situation the first matched pattern will be used. Patterns are matched according to their order in XML file.

Thanks.

0
Comment actions Permalink

Ok, that makes sense.  But in my case if the first regex matches, I still want the others to run.

For instance.  I have the following text:

"Made updates to fix bugs caused by r1494, this is resolves issue #239"

I want "r1494" to become a link to the SVN changeset and "#239" to become a link to our bug tracking system.

Is this possible?

0
Comment actions Permalink

Probably not. I guess we can add an option to allow multiple pattern matching to support it. Can you please file a bug about this feature?

0
Comment actions Permalink

I saw that Joe opened an issue for this, TW-8125. From reading the issue it looks like it was supposed to have been fixed in 4.5.2. I am running 8.0.5 (build 27692) and still seeing this - only the first matching pattern seems to be applied. Am I misreading that it was supposed to be fixed already, or was there perhaps a regression?

0

Please sign in to leave a comment.