How to add/modify change set comments using RTC Advisor ?
I am working on an RTC advisor to append stream name to the changeset's comment so far with no luck. Everything seems to be working fine apart from the setComment(..) method. My code is posted below, any help is much appreciated. Thanks in advance.
Accepted answer
As described here: https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/ an advisor must not modify the data. An advisor can block an operation ("Advise on the operation"), however, the interface is not designed to allow changes to the incoming data. A follow up action can modify the data of an operation.
Comments
Thanks much for the quick response ralph! Can i achieve this through a follow up action then ?
As mentioned above:
A follow up action can modify the data of an operation.
Sure. Thanks a lot!
Hi Ralph, i tried the follow up action, but i see a Stale data error while trying to deliver any changeset where this follow up action is applied.
CRJAZ0223I The following item has been changed by another operation:
Current: com.ibm.team.scm.common.internal.impl.ChangeSetImpl@aed37d5a (stateId: [UUID _OjnR8FVyEeeEyJGAUJn5vw], itemId: [UUID _OSeeoFVyEeeEyJGAUJn5vw], origin: <unset>, immutable: true) (contextId: [UUID _Dp6kMdwTEd2jUupDpQV1Rw], modified: 2017-06-20 10:07:54.959, workingCopy: false) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: [UUID _OYdK0FVyEeeEyJGAUJn5vw]) (active: true, comment: [NAGESH-SCM-TEST_20NOV2015]hello world, lastUpdatedDate: 2017-06-20 10:07:53.219, sourceId: null, sourceType: 0, originalSourceId: null, originalSourceType: 0)
Both comments above is the error description i see while delivering the changeset, had to post 2 comments cause of the character length limit.
A stale data is basically telling you that there is a new version of the item, so I refresh information I work with in a follow up action, before modifying it. I don't have an example where I tried to do what you do, so that is all I can provide at the moment.
Hi Ralph,
This advisor is setup on Deliver operation to amend the stream name into the change set comments.
Advisor is amending the comment with stream name [<stream name>] but meanwhile something else (???) is resetting comment back to original before deliver operation completes. So, there are conflicts with the comment data.
So, do you have any idea on what possible service is resetting the comment.?
Regards,
Nagesh S
Nagesh, I don't and without trying it myself I can't. Unfortunately I don't have example code and the time to try this out.
I have used follow up actions with work items to modify the work item that was saved. That has worked for me and you can find examples on my blog e.g. where I refresh the work item before saving.
I have not tried that with SCM and SCM might be different. I am unable to help you here. Maybe other contributors have hints. If you could provide more of the code, e.g. somewhere online, maybe someone can spot something.
Comments
Nagendra Prasad
Jun 19 '17, 3:21 a.m.The advisor will be triggered on delivering the chengeset, even comment is printed in the log but the comment is not being set to the changeset.