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

How to access change set file information

 How can I access the files created/modified by a change set using the java API's ? I cannot find any documentation on how to accomplish this.

Here is the closest doc I have found : https://jazz.net/forum/questions/38090/get-files-referred-in-a-change-set-via-rest-apis but it falls short in actually showing how to implement getVersionable.

0 votes



2 answers

Permanent link
What object types do you have? The API on IScmService might be useful. Check out #getHistoryForVersionable. From there you can get the ChangeHistoryEntry, which gives you the ChangeSetHandle, which you can do a fetch on to get the IChangeSet, and then you can get the list of IChanges, which gets you the handles to the before and after state. 
  

0 votes

Comments

What do you mean by 'object types' ? All I want to display is a listing of files delivered for a given stream along with the author of that delivered file. Where can I find the IScmService API ? 


Permanent link
Sorry, I was confused on which APIs you were using, the ones I referred to probably not available to you. Here is a (warning: completely untested) snippet of code which might help you if you're using the plain Java APIs. 

    public static void main(ITeamRepository repo) throws Exception {

        IWorkspaceManager wsmgr = SCMPlatform.getWorkspaceManager(repo);

        IItemManager imgr = (IItemManager) repo.getClientLibrary(IItemManager.class);

        IVersionableManager vmgr = (IVersionableManager) repo.getClientLibrary(IVersionableManager.class);


        IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();

        // TODO set the cs search criteria

        

        List<IChangeSetHandle> list = wsmgr.findChangeSets(criteria, 100, null);

        for (IChangeSetHandle handle : list) {

            IChangeSet cs = (IChangeSet) imgr.fetchCompleteState(handle, null);

            IContributorHandle authorHandle = cs.getAuthor();

            IContributor author = (IContributor) imgr.fetchCompleteState(authorHandle, null);

            // TODO do something with the author


            List<IChange> changes = cs.changes();

            for (IChange change : changes) {

                IVersionableHandle beforeHandle = change.beforeState();

                IVersionable before = vmgr.fetchCompleteState(beforeHandle, null);

                // TODO do something with the before state


                IVersionableHandle afterHandle = change.afterState();

                IVersionable after = vmgr.fetchCompleteState(afterHandle, null);

                // TODO do something with the after state

            }

        }

    }


0 votes

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

Question asked: Oct 25 '12, 9:56 a.m.

Question was seen: 4,150 times

Last updated: Oct 25 '12, 4:29 p.m.

Confirmation Cancel Confirm