Question

Our TeamCity builds a complete installer package that includes several web applications, console applications and win forms applications. It constitutes an application suite. Each of these applications has it's own Mercurial repository.

What we'd like to be able to do is automatically supply release notes for each version. TeamCity already displays Mercurial commit messages in web interface when one hovers over changes for a build. Is it possible to somehow capture those messages during a build and extract them to a text file in agent work folder?

Was it helpful?

Solution

I don't know TeamCity, but I have a simple method of taking the commits of a bit of software and formatting it into a neat history log, which I guess is what you're after. Perhaps you can take this and modify it to suit your needs - it uses only mercurial commands, so you could add it as a dependency of your build (I have a post-build step of my VC++ project which runs the command and outputs to a text file).

I have a simple template like so:

$ cat history.template
changeset = '{tags} {rev}\t{desc|fill68|strip|tabindent}\n'
start_tags = '\n'
tag = '{tag},'
last_tag = '{tag} : {node|short} @ {date|shortdate}\n'

And when I use the following hg command to create a usable history log:

hg log --style history.template -r "reverse(::.) & !desc('Added tag')"

The command takes commit comments of all ancestors of the working directory, outputting a tag and changeset hash, along with the date the tag was created, and then all associated changes. Here's an example hg log -G output of a test repo, showing the default and release branches:

@  21[tip]:18   c676cfe95284   2012-12-12 10:12 +0000   rob
|    Added tag 0.0.5 for changeset d0869f1c84ba
|
| o  20   7618cafcfc5d   2012-11-26 17:23 +0000   rob
| |    More changes indeed
| |
| o  19:17   ffc8bef85a2e   2012-11-26 17:22 +0000   rob
| |    Some additional files were needed
| |
o |  18[0.0.5]:15,17   d0869f1c84ba   2012-11-22 17:25 +0000   rob
|\|    Releasing
| |
| o  17   a41d817184ea   2012-11-22 17:25 +0000   rob
| |    Made the last change
| |
| o  16:13   e790e9022e70   2012-11-22 17:24 +0000   rob
| |    Made some changes using "record"
| |
o |  15   15f21a6f554a   2012-11-13 17:03 +0000   rob
| |    Added tag 0.0.4 for changeset c316b232c95c
| |
o |  14[0.0.4]:10,13   c316b232c95c   2012-11-13 17:03 +0000   rob
|\|    Merging, eh?
| |
| o  13   ba00c7045a23   2012-11-13 17:02 +0000   rob
| |    Modified revset selection for logging
...

The template and command shown outputs the following:

0.0.5 : d0869f1c84ba @ 2012-11-22
 18     Releasing
 17     Made the last change
 16     Made some changes using "record"

0.0.4 : c316b232c95c @ 2012-11-13
 14     Merging, eh?
 13     Modified revset selection for logging
 12     When logging history select only ancestors of the working directory
 11     Added history logging
...

Add a comment if you would like some explanation of the command-line or template.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top