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

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

0 votes


Accepted answer

Permanent link

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


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/

Andy Jewell selected this answer as the correct answer

1 vote

Comments

 Perfect!  Thanks, Ralph!

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,930
× 411

Question asked: Mar 09 '17, 7:51 p.m.

Question was seen: 3,271 times

Last updated: Mar 10 '17, 10:38 a.m.

Confirmation Cancel Confirm