It's all about the answers!

Ask a question

RTC Client Java API: How do I get the state of the user's version before the merge from an IChange merge state?


Geoff Alexander (18123538) | asked Mar 18, 3:16 p.m.
edited Mar 18, 3:43 p.m.

I have an IChange instance, change, which I obtained from an IChangeSet instance, changeset, via a call to changeSet.changes().  I use change.mergeStates() to get a list of the change's merge states.  From the IChange.mergeStates Javadoc:

Consider this list to be the proposed versions that were merged with the before state. The after state is the versionable after the merge has been completed. The state of the user's version (mine) before the merge is not recorded in this IChange. It can be found in the IChange of the previous IChangeSet state.

How do I get the IChange of the previous IChangeSet state?  I tried calling changeSet.getMergePredecessorState() to get the the previous IChangeSet state.  However, it always returns null.

Accepted answer


permanent link
Andrew Niefer (6785) | answered Mar 24, 1:37 p.m.
JAZZ DEVELOPER
I believe that getMergePredecessorState will always be null for SCM items.

You want IChangeSet.getPredecessorState() (defined on IAuditable),
To fetch that previous state you will need to use IItemManager.fetchCompleteState rather than just fetchCompleteItem.

Geoff Alexander selected this answer as the correct answer

Comments
Geoff Alexander commented Mar 24, 3:34 p.m.

Thanks for the response.  It was a misunderstanding on my part.  I finally realized that IChangeSet.getPredecessorState() gives the history of a single change set.

Your answer


Register or to post your answer.