Version off by one?
Hi,
A little background: I'm trying to add labeling support to my Rational Team Concert VCS plugin.
I've implemented the LabelingSupport interface and the label method gets called as expected, but the value of label looks like its off by one...
I was expecting that if the version returned by VcsSupportCore.getCurrentVersion is buildserver-8 and I trigger a build then the value passed to the label method would be buildserver-8.
Instead label is called with buildserver-7...
If I trigger a custom build and select "[10 Apr 13:31] (com.systematic.tools.rtc: buildserver-8) simon soendergaard: bas" as "Last change to include:", label are still called with the value buildserver-7
In general it looks like its always one lower that what I expect.
So it the is behavour intentional and if not what could be triggering it?
Other details:
fromVersion parameter in BuildPatchByCheckoutRules.buildPatch() is also off by one.
toVersion parameter in UpdateByCheckoutRules2.updateSources() is also off by one.
Tested with TeamCity 6.5.6 and 7.0.2
Thanks,
/Simon
Please sign in to leave a comment.
Hi Simon,
it should work as you expected. What was the revision on the changes tab of the build you labeled?
The revision was buildserver-8




I've just reproduced it again and took some screenshoots in the process.
ME: check in new change.
TEAMCITY: serversideplugin.getCurrentVersion()
SERVERSIDEPLUGIN returns: buildserver-9
TEAMCITY UI:
ME: Press Run...
TEAMCITY: serversideplugin.getCurrentVersion()
SERVERSIDEPLUGIN returns: buildserver-9
TEAMCITY: agentplugin.updateSource():
TEAMCITY: serversideplugin.label():
TEAMCITY UI:
Here is a dump of the content of the Build Parameters tab
User Defined Parameters
Actual Parameters on Agent
Configuration Parameters
System properties
Environment variables
Br,
/Simon
Simon,
this is quite strange.. could you please enable debug-all loging preset in TeamCity 7.0.2 at 'Administration > Diagnostics', reproduce it again and provide teamcity-server.log and teamcity-vcs.log?
Here are the logs.
I commited a change and triggered a change in currentVersion from buildserver-10 to buildserver-11. (verified via debugger)
updateSource and label was called with buildserver-10 (verified via debugger)
Attachment(s):
logs.zip
I found a following line in teamcity-vcs.log:
[2012-04-19 14:46:15,394] INFO [TeamCity Agent ] - jetbrains.buildServer.VCS - Setting build revisions on agent=pc-3263 {id=1, host=127.0.0.1:9091, agentTypeId=1, pool=Default}, buildPromotion=BuildPromotion{myId=28, myPersonal=false, myBuildTypeId='bt2', myModificationId=6, myRevisions=[BuildRevision[myVcsRootEntry=VcsRootEntry[myVcsRoot=xx@https://jazz.net/sandbox02-ccm/ {instance id=2, parent id=1}, myCheckoutRules==>
], myRevision=RepositoryVersion[myVersion='buildserver-10', myDisplayVersion='buildserver-11']]], myAssociatedBuildId=24}, revisions={xx@https://jazz.net/sandbox02-ccm/ {instance id=2, parent id=1}=buildserver-10}
it seems like plugin reports correct displayVersion, but version is off by one.
Dmitry,
Not sure if you think that the off by one error is in the plugin code or in the teamcity code base?
This is my implementation of getVersionDisplayName:
public String getVersionDisplayName(@NotNull String version, @NotNull VcsRoot root) throws VcsException {
return version;
}
I don't see how the plugin can cause an off by one error between the version reported by getCurrentVersion() and what is returned by getVersionDisplayName().
Br,
/Simon
Please check your code in the collectChanges() method in the server part of plugin, make sure you use right revisions in the ModificationData constructor. I think this behaviour can be caused by the wrong revisions given to ModificationData.
Dmitry,
You were spot on! I was in fact returning the wrong revision for version and were using the correct one for calculating the displayVersion....
Thank you for the help!
Br,
/Simon.
Great! :)
BTW, do you have any plans to open-source the plugin?
I would love to open-source the plugin. But I dont make the plans... I just write the code :-) With that said I will ask and try to make it happen.
Br,
/Simon
I see, anyway do not hesitate to ask any questions regarding plugin development.
Hi Simon,
I have a related question on your RTC plugin: Could you please write to teamcity-feedback@jetbrains.com or to yegor.yarko@ in the same domain to discuss it?