Identify file paths of changes within IOperationParticipant
I am writing an IOperationParticipant for the com.ibm.team.scm.service.changehistory.modification Operation (Deliver (phase 2)). As part of the functionality I need to be able to determine the affected resources path during the following changes:
- File modification
- File addition
- File deletion
- File reparenting
I am having trouble identifying how I can get the following information however (running in the Server as an IOperationParticipant):
2. File addition - how to find out what the path will be
4. File reparenting - how to find out what the path was (both the afterState and beforeState seem to yield the new path)
Any help much appreciated,
Dan
Accepted answer
- Try using the source (ie. repository workspace) to look up the path in the case of the file addition.
- Try using the target (ie. stream) to look up the path in the case of reparenting.
You'll want to check your service configuration provider that you give to the the #configurationLocateAncestors call. Ensure you're using the provider for the correct context (source or target).
Comments
Thanks for that, so far I have just been using the target stream. How would I access the other contexts you mention?
You asked about getting the other contexts. I assume you're using the deliver operation data.
AdvisableOperation#getOperationData returns an object. For a deliver operation, it is DeliverOperationData that can give you the source and target. If you're not already using this, this is the way to get the source and target for the deliver operation as well as other data such as the change sets.
Hi Tim,
Many thanks for this, and the pointer on obtaining the contexts - I am now able to access the path infomation I was looking for.
I did however notice that the object returned from AdvisableOperation#getOperationData was not an instancof DeliverOperationData but SCMDeltaSource so I used the source and target from the IChangeHistoryAddOperandDelta objects returned from IScmDeltaSource#getDeltas(IChangeHistoryAddOperandDelta.class) instead (version 4.0.0).
1 vote