SVN Revision number - use "last committed" possible?

I'm currently evaluating TC as a replacement for CruiseControl.NET. I have two or three branches that I make builds from, that are obviously all in the same directory.

One of the things I did with CC was have the build number be the 'last committed' SVN revision number. This effectively isolates the branches, so if :

  • Revision 5440 is in branches/2.0
  • Revision 5441 is in trunk
  • Revision 5442 is in trunk

Then when I do a build of the 2.0 branch, instead of it saying revision 5442, it says 5440.

With CC.NET, this was accomplished using the svnRevisionLabeller plugin:

We are using revision numbers for the build because it integrates nicely with the rest of our practices: the revision number is the last part of all version numbers; seeing a comment in a ticket that says "fixed in trunk revision 5441" makes it clear to QA that they need to use build 5441 or higher to test that fix; Seeing a version number makes it perfectly clear which revision source code was used for the build (without an extra lookup step).

I initially used just the highest number like TC does by default, but this caused a lot of confusion because someone would see build "debug r5442" of 2.0, and then wonder why there was no rev 5442 in 2.0, or even more often, get a debug right after 5440 was committed, and then more fixes would go to trunk, and then there'd be a nightly release build, and QA would freak out and wonder what the difference was between and (you have to look at revision history to know). When the release build is just (even though the svn revision is actually 5442) it just makes those problems go away.

I tried putting in the exact path for each project as my svn repository URL, but it's still using the highest global revision number.

Is it possible to use the highest committed revision number as the build number in TC? Even being able to run a custom command would work.

Comment actions Permalink

Hello Greg,

  What version of TC do you use? I think the problem you're describing is fixed in TeamCity 5.0 and it was filed as issue

  Hope this helps,

Comment actions Permalink

I'm using 5.1.2. I can actually confirm this is working correctly, but I suffered from the same issue that Alex Schwartz described in Immediately after I  set up the repository, it used the latest revision. The second build (and onwards) it uses the highest committed revision. I of course didn't even consider this, so after I changed the config, did a build, and got the incorrect number, I posted this message. I understand the technical reasoning for this, but it's not intuitive from a user point of view at all.



Please sign in to leave a comment.