Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

1

0 votes

Comments

Can you provide more context or a code sample? IVersionable has no notion of IChangeSet.

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 ?

} } }

Hi Tim,
I provided the code. Please replay.
Thanks,
Yehiel

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.

Thanks.
Do you have any idea how to get the history for each file in the changeset ?

Does someone knows how to get the file's history on deliver operation server side ?
Thanks!

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

showing 5 of 7 show 2 more comments

Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,949
× 1,204
× 169
× 149

Question asked: Nov 04 '13, 8:44 a.m.

Question was seen: 29,728 times

Last updated: Jul 05 '15, 2:36 p.m.

Confirmation Cancel Confirm