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

How to get IVersionable 'history'

 Given IVersionable (or file/folder/symlink UUID)

How can I get its history in repository - I mean, all the change-sets in repository that contain this specific item.

It is like eclipse 'histroy in repository' just need the list of change-sets, no 'graph' like data structure is needed

Thanks

Boaz

0 votes


Accepted answer

Permanent link
You can try using this - 

ScmService->getHistoryForVersionable(ServiceHistoryProvider historyProvider, IVersionableHandle versionableHandle, int limit, boolean examineEras, ISynchronizationTimes[] syncTimes,IRepositoryProgressMonitorHandle monitor)

WorkspaceManager manager = (WorkspaceManager) SCMPlatform.getWorkspaceManager(repo);

IScmService service = manager.getServerConfigurationService();

ServiceHistoryProvider historyProvider = ServiceHistoryProvider.FACTORY.create((IWorkspaceHandle) workspace.getContextHandle(), componentHandle);

ChangeHistoryEntry[]  entries = service.getHistoryForVersionable(historyProvider, versionable, 100, true, null, null);
Boaz Nahum selected this answer as the correct answer

0 votes

Comments

 Thank you so much Surya


Your answer if very useful. Indeed I get the history entries, but my problem that I got only those in the specified repository workspace/stream.

Is there a way to get the entire file history - something like 'Show all in repository" in eclipse.


Boaz





Sure.
Files belong to components. And, in order to get history of a file in component, you will need to provide a context - workspace or stream. A component can be included in more than one stream and these stream can have different set of changesets. Streams are a way to isolate changes of one team from another. When teams modify a file in a component, they are always modifying it in a context - in a workspace or in a stream. I dont think there is such a thing as 'show history in repository'. 

Well, yes, the Eclipse client has this feature 'show all in repository'.
I guess, you could query for all changesets in a component and get history in repository.
You can call ScmQueryService.findChangeSets() and set context for workspace as null to widen the scope to repository.
IVersionableHandle file;
IWorkspaceManager manager = SCMPlatform.getWorkspaceManager(repo);       
IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setComponent(testComponent);
criteria.setOldestFirst(true);
//criteria.setContext(testWorkspace.getContextHandle());
if (file != null) {
      criteria.setItem(file);
}
List<IChangeSetHandle> changesets =  manager.findChangeSets(criteria, IWorkspaceManager.MAX_QUERY_SIZE, monitor);

Your answer

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,936
× 51

Question asked: Dec 03 '15, 3:28 a.m.

Question was seen: 2,830 times

Last updated: Dec 15 '15, 3:27 p.m.

Confirmation Cancel Confirm