[Java] Get the full path of a file at change set
![]()
Hello,
I am searching for a NEW CREATED ,not edited yet, .txt file that is located at change set WITHIN a specific work item. Then I need to create locally over my pc the full path directory of this file. For example if there a file called"test.txt" that it's located at: Project1-->Folder1-->Folder2-->test.txt Till now I have managed to search for this file. Now I need to fetch the full directory and create similar one over my pc: Result at my pc: Folder1-->Folder2-->test.txt That's what I did to search for the file within a changeset: public IFileItem getTextFileFile(IChangeSet changeSet, ITeamRepository repository) throws TeamRepositoryException{ IVersionableManager vm = SCMPlatform.getWorkspaceManager(repository).versionableManager(); List changes = changeSet.changes(); IFileItem toReturn = null; for(int i=0;i<changes.size();i++) { Change change = (Change) changes.get(i); IVersionableHandle after = change.afterState(); if( after != null && after instanceof IFileItemHandle) { IFileItem fileItem = (IFileItem) vm.fetchCompleteState(after, null); if(fileItem.getName().contains(".txt")) { toReturn = fileItem; break; } else { continue; } } } if(toReturn == null){ throw new TeamRepositoryException("Could not find the file"); } return toReturn; } Thanks in advance. |
One answer
![]()
This has already been answered in other questions. I've posted a reply to your followup in one of the other questions. If you have any questions about those answers, please clarify because you haven't provided here what went wrong with your attempts given those answers.
|