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?
Please sign in to leave a comment.
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<a title="Click to open this issue"
href="/trac/ticket/$2">#$2</a>$3" description="Trac link" />
<transformation-pattern search="(.+)r([0-9]+)(.?+)" replace="$1<a title="Click to open this changeset"
href="/trac/changeset/$2">r$2</a>$3"
description="Subversion link" />
</comment-transformation>
<report-tab title="Code Coverage" basePath="coverage.zip" />
<report-tab title="JavaDoc" basePath="javadoc.zip" />
</server>
What version of TeamCity do you use?
Version 4.5 (build 8944)
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.
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?
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?
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?