How to get Line of code changes
I am able get change set details using below code:
List<ChangeImpl> changeSetList = ((IChangeSet) repo.itemManager().
fetchCompleteItem((IChangeSetHandle)changeSetHandle, IItemManager.DEFAULT, null)).changes();
IScmService scmService = (IScmService) ((IClientLibraryContext) repo).getServiceInterface(IScmService.class);
for(ChangeImpl chSet : changeSetList){
System.out.println("Change Set Details: "+chSet);
IVersionableHandle after = chSet.afterState();
IVersionable item = (IVersionable) scmService.fetchState(after, null, null);
if (item instanceof IFileItem) {
IFileItem fileItem = (IFileItem) item;
String readContent = readFileContent(item, repo);
System.out.println("READ CONTENT :: "+readContent);
}
}
How to get number of line of code added or modified or deleted last in the repository? Is their any method to get it for a specific file?
|
Accepted answer
Titas,
Titas Dutta selected this answer as the correct answer
Comments
Titas Dutta
commented Jan 04 '18, 4:42 a.m.
Thanks Luca..It's worked but if I have 100 files committed or more than that then the process would take more time or get slow down for finding number of line committed(added,modified,removed). Is there any other way like method calls which returns the history of a file? Or through OSLC / REST API call can we get the same? |
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.