Mercurial Labels

We have teamcity setup to trigger a build on mercurial changes.  I also turned on labeling (by selecting Successful Only) and I checked the checkbox next to my VCS root directly below the labeling option.

I'm confident that the labeling is happening because I notice a never ending loop of labeling -> changeset -> build triggered -> labeling -> changeset -> build triggered -> ...

However my concern is that in Mercurial on my machine I can't see any of the tags when doing "hg tags", even after a hg pull.  Are they going to a different branch or something?

9 comments
Comment actions Permalink

Hi Paul,
it seems to me that never ending loop you mentioned is a bug I'll create an issue for that.
The reason for this behavior is that we tag revision and push it to the original repository as a separate commit, after that TeamCity detects this commit and starts a build and then label build, so we get yet another commit...
It is strange that you do not see them after pull, what version of hg do you use? I checked it with hg 1.7.1 - and it works. Tags should be on the branch from VcsRoot configuration, it is called 'default' by default.

0
Comment actions Permalink

On my machine:
c:\>hg branch
default

In the teamcity configuration for VCS Root the branch name is blank, as in no text entered.  Does teamcity treat the blank branch name field as "default" or something else?

hg version is 1.8

0
Comment actions Permalink

A blank branch name is treated as 'default'. Also since your build is started again and again TeamCity detects new commits in the repository.

0
Comment actions Permalink

Is it possible that for the build triggering, teamcity is comparing the tip of it's repo to the tip of the default branch?  If it was able to commit, but not push the changeset for the label, then it's tip would indeed be different from the default branch's tip, thus triggering a build.

There are two things I am certain of:
1. Team city is doing something at label time because we see the build triggered over and over again
2. The changeset is not making into the default branch; it is not (sucessfully) pushing.

Are there log files somewhere that would reveal the mercurial commands executed and mercurial's response?

0
Comment actions Permalink

Yes, you can enable 'debug-vcs' logging preset 'Administration > Server Configuration > Diagnostics' and watch content of teamcity-vcs.log file. In debug mode all hg commands we run and their results will be logged there.

0
Comment actions Permalink

It looks like we have a permissions issue between teamcity and our mercirual repository.  Below is part of the log file during the tag.  It is interesting that clearly the push failed but the rebuild was triggered.  I am going to now investigate how to get the permissions set properly to push.

[2011-04-14 01:37:08,475]   WARN [al executor 894] -      jetbrains.buildServer.VCS - Error output produced by: cmd /c hg tag -r 7abc2a998d89 build-1.0.0.3651
[2011-04-14 01:37:08,475]   WARN [al executor 894] -      jetbrains.buildServer.VCS - No username found, using 'teamcity@computername' instead

[2011-04-14 01:37:10,038]   WARN [al executor 894] -      jetbrains.buildServer.VCS - 'cmd /c hg push http://projectname%5Cteamcity:******@code/dev/oa/' command failed.
stderr: abort: authorization failed
stdout: pushing to http://projectname%5Cteamcity:***@code/dev/oa/
searching for changes

[2011-04-14 01:37:10,038]   WARN [al executor 894] -      jetbrains.buildServer.VCS - Failed to set label 'build-1.0.0.3651'
jetbrains.buildServer.vcs.VcsException: 'cmd /c hg push http://projectname%5Cteamcity:******@code/dev/oa/' command failed.
stderr: abort: authorization failed
stdout: pushing to http://projectname%5Cteamcity:***@code/dev/oa/
searching for changes

at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandUtil.commandFailed(CommandUtil.java:51)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandUtil.checkCommandFailed(CommandUtil.java:34)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandUtil.runCommand(CommandUtil.java:74)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandUtil.runCommand(CommandUtil.java:59)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.BaseCommand.runCommand(BaseCommand.java:86)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.command.PushCommand.execute(PushCommand.java:44)
at jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialVcsSupport.label(MercurialVcsSupport.java:604)
at jetbrains.buildServer.vcs.impl.VcsLabeler.setLabel(VcsLabeler.java:45)
at jetbrains.buildServer.vcs.impl.VcsLabeler.access$400(VcsLabeler.java:64)
at jetbrains.buildServer.vcs.impl.VcsLabeler$3$1.run(VcsLabeler.java:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

0
Comment actions Permalink

Hi Paul,

wrong user name used for tagging is a known bug (http://youtrack.jetbrains.net/issue/TW-16045), please watch this issue, I'll attach a build of hg-plugin with a fix there when it will be available.

Also it turns out that tag -> build -> tag -> build loop is also a known problem for VCSes which impelement tags as usual commits. To workaround such behavior you can configure your VCS trigger to not fire a build on changes in .hgtags file.
To do that put '-:/.hgtags' into the 'Trigger rules' field of the trigger.

0
Comment actions Permalink

Hi Dmitry,

We have the same error when we label in hg. We are getting:

Failed: Failed to set label 'TPS-1.3.0.0': '"C:\Program Files\TortoiseHg\hg.exe" update -C -r default' command failed. stderr: abort: http authorization required

It would be great if you had a new plugin and a status on when it would get fixed.

Best Regards,
Michael Bertelsen
TrackMan A/S

0
Comment actions Permalink

Hi Michael,

do you have any subrepositories in you hg repository?

0

Please sign in to leave a comment.