How does the Mercurial Plug-in/TeamCity check for changes?

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.

3 comments

The plugin checks for changes from the last remembered revision (not from the revision used in successful build). This works as follows:
- if repo is not cloned: clone
- if repo is cloned: pull changes from remote repo
- with help of hg log we determine changes since last check
- changes are reported to TeamCity

0

Sorry, I think my topic threw off the question I was really trying to ask.

What is the process used to collect logs from Mercurial?  More specifically, what exact commands are being used?

My guess above is that "hg clone -U" is being used with "hg log" against the .hg directory that pops out.  This is all saved in TeamCity's cache on its server.  Am I right?

0

To determine change lists plugin invokes the following command:
hg log -v -b <branch name> -r rev1:rev2 [<paths>]

"default" is used as branch name if there is no branch specified in VCS root settings. Plugin also uses hg status to calculate files changed between revisions.

You are right that TeamCity clones repository to its caches dir and invokes log command over the cloned repo.

0

Please sign in to leave a comment.