How can I retrieve files from a changeset using the Java API?
I am trying to extract the files of a changeset using the Java API to the filesystem but haven't found a single reference in the forum for doing that. Is the approach supposed to be to load a workspace and then copy out the files from the paths contained in the changeset? Or is there a way to directly extract the files? I seem to remember seeing something about the latter method but I can't find anything.
Any help or suggestions would be greatly appreciated!
Andy
Accepted answer
Here some clues: Getting an IFileItem
IChangeSet changeSet = (IChangeSet) changeSetIterator.next();
if (changeSet == null) {
// It's possible that we don't have read access to this change
// set?
continue;
}
for (IChange change : (List<ichange>) changeSet.changes()) {
IVersionableHandle after = change.afterState();
IVersionable item = (IVersionable) scmService.fetchState(after,
null, null);
if (item instanceof IFileItem) {
IFileItem fileItem = (IFileItem) item;
</ichange>
Getting the data for an IFileItem is here: http://thescmlounge.blogspot.de/2013/08/getting-your-stuff-using-rtc-sdk-to-zip.html
Some more here: https://jazz.net/forum/questions/161098/how-to-retrieve-file-path-for-iversionable-from-ichangeset-with-ibaselineset-workspace-given
How to get the ISCMService in a Plain Java Client is explained here: https://rsjazz.wordpress.com/2016/02/04/setting-custom-attributes-for-scm-versionables/