Coming from Parabuild, I had to hack around in order to allow support for Mercurial. Seeing as how I had to go through all that hacking, I'm very interested to see how TeamCity handles getting changes from Mercurial repositories and checking to see if those changes are new since the last successful build. I have a _guess_ for how it works after looking around the open source, but I cannot attest to knowing Java well enough to understand what's happening.
My guess is that the TC server uses the command "hg clone -U <repo URL>" in order to just check out the .hg directory. By having just the .hg directory cached, the server is then able to run the "hg log" command and determine the changes made to the repository. As for checking what should go on the "pending changes" list, the plug-in basically uses the log between the last-successfully-built revision and the tip. Is my guess right? I'm asking because the hacky way I did it with Parabuild involved checking the repository's RSS feed and parsing that down into useful information. At the time I did not know of the -U argument for hg clone and thought I'd have to fully clone a directory in order to check its logs.
Thanks for the information. It's not absolutely dire that I have it immediately but it'd be really nice to make sure my guess is correct.