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

How to get IChangeHandle

I'm trying to get the IChangeHandle object in follow two ways:

1. IChangeSetHandle csHandle = workspaceConnection.getCurrentChangeSet(comp);
 ==>But this way only get a null object.

2. IChangeSetHandle csHandle1 = workspaceConnection.createChangeSet(comp, null);

==>But this way thow follow Excpection:

com.ibm.team.scm.common.InvalidStreamOperationException: Change sets cannot be created on a stream
 at com.ibm.team.scm.client.internal.WorkspaceConnection.createChangeSet(WorkspaceConnection.java:399)
 at com.ibm.team.scm.client.internal.WorkspaceConnection.createChangeSet(WorkspaceConnection.java:368)
 at main.MainTest2.deliverChangeSets(MainTest2.java:328)

Is there any one can help ? I want to use it to deliver a local change onto stream.

lcm.refreshChanges(new ISandbox[]{sbox}, RefreshType.TRAVERSE_ALL_WITH_RECOMPUTE_OF_KNOWN, null);
ILocalChange[] localChanges = lcm.getPendingChanges(new IShareable[]{shareable}, null);

//get the IChangeHandle(csHandle) object here

checkInOp.requestCheckin(localChanges, csHandle, "testing comment", null);

IChangeHistorySyncReport sync = workspaceConnection.compareTo(workspaceConnection, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY, Collections.EMPTY_LIST, null);
   workspaceConnection.deliver(workspaceConnection, sync, workspaceConnection.getBaselineSets(null), Arrays.asList(localChanges), null);

1 vote


Accepted answer

Permanent link
1. IChangeSetHandle csHandle = workspaceConnection.getCurrentChangeSet(comp);
 ==>But this way only get a null object.
getCurrentChangeSet() returns null if there is not an active change set for the given workspace/component pair. From your later questions, it sounds like your IWorkspaceConnection may have been created on a stream. Streams can't have active change sets, so this is expected behaviour.

2. IChangeSetHandle csHandle1 = workspaceConnection.createChangeSet(comp, null);
==>But this way thow follow Excpection: com.ibm.team.scm.common.InvalidStreamOperationException: Change sets cannot be created on a stream
This exception is thrown when createChangeSet() is called on an IWorkspaceHandle that corresponds to a stream. Make sure that you're calling this on a workspace connection that has been created from a workspace. Be aware that the IWorkspace object can be used to refer to a workspace or a stream. The difference is revealed by calling isStream() . For most read methods you can use workspaces and streams interchangeably, but only workspaces can be committed to.
Tifa Tan selected this answer as the correct answer

1 vote

Comments

Hi Evan Hughes, Many thanks your help on this issue.

1 vote

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,936
× 1,202
× 51

Question asked: Nov 24 '14, 6:52 a.m.

Question was seen: 4,357 times

Last updated: Nov 25 '14, 6:41 a.m.

Confirmation Cancel Confirm