How to get IChangeSet from IVersionable ?
Hello,
I have IVersionable (state of IChange) but need to have the last ChangeSet that changed this file.
How to get the IChangeSet out of it's IVersionable ?
Thanks,
Yehiel
Hello,
I have IVersionable (state of IChange) but need to have the last ChangeSet that changed this file.
How to get the IChangeSet out of it's IVersionable ?
Thanks,
Yehiel
Comments
Tim Mok
JAZZ DEVELOPER Nov 04 '13, 8:55 a.m.Can you provide more context or a code sample? IVersionable has no notion of IChangeSet.
Yehiel Glass
Nov 07 '13, 8:58 a.m.public class createApprovals extends AbstractService
implements IOperationParticipant {
public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
Object operationData = operation.getOperationData();
final IWorkItemServer itemServer = getService(IWorkItemServer.class);
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IScmService scmService = getService(IScmService.class);
IProjectAreaHandle projectArea = operation.getProcessArea().getProjectArea();
DeliverOperationData data = (DeliverOperationData) operationData;
List<IChangeSetHandle> changeSetHandles = data.getChangeSetHandles();
int ArraySize = changeSetHandles.size();
IChangeSetHandle[] csArray = new IChangeSetHandle[ArraySize];;
IItemServiceIterator changeSetIterator = ItemServiceIteratorFactory.INSTANCE.createFetchItemsIterator(itemService, changeSetHandles.toArray(new IItemHandle[changeSetHandles.size()]), IRepositoryItemService.COMPLETE);
while (changeSetIterator.hasNext()) {
IChangeSet changeSet = (IChangeSet) changeSetIterator.next();
for (IChange change : (List<IChange>) changeSet.changes()) {
IVersionableHandle versionableHandle = null;
versionableHandle = change.afterState();
IVersionable item = (IVersionable) scmService.fetchState(
versionableHandle, null, null);
configProvider = ServiceConfigurationProvider.FACTORY.create(data.getDestWorkspace(),changeSet.getComponent());
//Here is the point I need help (I need to get the last IChangeSet for each change - and it's related workitem):
//I cheked some options:
//scmService.getHistoryForVersionable(historyProvider, versionableHandle, limit, examineEras, syncTimes, monitor)//Thats what I'm looking for, but problem:This method can only be called from outside of a transaction, or within a read transaction
//scmService.historyGetPredecessorState(provider, state, monitor) - Returns a versionable handle. How to get IChangeSet out of versionable handle ?
} } }
Yehiel Glass
Nov 04 '13, 10:12 a.m.Hi Tim,
I provided the code. Please replay.
Thanks,
Yehiel
Tim Mok
JAZZ DEVELOPER Nov 07 '13, 9:14 a.m.I've converted your answer to a comment. In the future, provide the information about your question as part of the question so that others don't think that your question has already been answered.
Yehiel Glass
Nov 07 '13, 9:41 a.m.Thanks.
Do you have any idea how to get the history for each file in the changeset ?
Yehiel Glass
Nov 10 '13, 4:01 a.m.Does someone knows how to get the file's history on deliver operation server side ?
Thanks!
Chandan M B
Jul 05 '15, 2:36 p.m.Hello Yehiel Glass
If you have got any solution for your question. Please paste the code.
I am in need of the same use case
Regards,
Chandan