(Hg) Repository and build chains - what is pulled/cloned?


We've got a build chain where we have a mercurial vcs root. To make sure every build step uses the same source even when agent side checkout is used, can anyone here confirm if Teamcity is doing (assuming changeset X is used)...

1. Clone/Pull ALL repository
2. hg update X


1. Clone/Pull revision X
2. hg update tip


We've tried to verify this by looking at the logs but cannot make sure what alternative is used. The reason I ask is because we in a late build step want to push the changesets to another repository - at that point we must make sure what revision should be pushed if alternative A is used above - if b is used we don't have to care about at what changeset id build chain is using.


Comment actions Permalink

Answer my own question if somebody else is having the same question...

It seems TeamCity is using alternative A - it clones/pulls LATEST code and then updates/checkouts a specific changeset. In other words - you cannot push all the repository to some other repository expecting only the checkouted changesets to be part of the push -> you need to explicitly push the "current" revision/changeset.

If this is a bug in TeamCity or by design, I don't know (but it sorts of make sence knowing that TeamCity supports running old builds and needs to jump back and forth in the local repository).

Comment actions Permalink


TeamCity indeed pulls a whole repository. As far as I understand this is faster than pulling a specific revision, because a remote server does less calculations of what revisions should be sent to the client. But if you want to push only revision in build you can do so, the hg push command has the -r option which is revision to be pushed. You can get a revision used in build e.g. from predefined build parameter 'build.vcs.number.<VCS root ID>'. Hope it helps.

Comment actions Permalink

Yes, thanks. That's works just fine - just wanted to be sure how TeamCity mercurial plugin worked internally.


Please sign in to leave a comment.