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

How do you create a snapshot using the java api?

How do you create a snapshot using the java api?

0 votes



8 answers

Permanent link
Try:

import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.scm.client.IWorkspaceManager;
import com.ibm.team.scm.client.SCMPlatform;
...

ITeamRepository repo = ...
IWorkspaceHandle ws = ...
IWorkspaceManager manager = SCMPlatform.getWorkspaceManager(repo);
IWorkspaceConnection connection = manager.getWorkspaceConnection(ws);
IBaselineSet snapshot = connection.createBaselineSet(null, "snapshot name", "snapshot comment", true, progressMonitor);

0 votes


Permanent link
compile error:

incompatible types
found : com.ibm.team.scm.common.IBaselineSetHandle
required: com.ibm.team.scm.common.IBaselineSet
IBaselineSet snapshot = stream.createBaselineSet(null, "snapshot name", "snapshot comment", true, MONITOR);

my code snippit:

// Create Stream
IWorkspaceConnection stream = wm.createStream(processarea, streamName, msg, MONITOR);

// Add new components
stream.addComponent(component,baseConnection,false,MONITOR);

// Create snapshot
IBaselineSet snapshot = stream.createBaselineSet(null, "snapshot name", "snapshot comment", true, MONITOR);

0 votes


Permanent link
change to

IBaselineSetHandle snapshot = stream.createBaselineSet(null, "snapshot name", "snapshot comment", true, MONITOR);

compiles but blows up:

Exception in thread "main" java.lang.NullPointerException
at com.ibm.team.scm.client.internal.WorkspaceConnection.createBaselineSet(WorkspaceConnection.java:3264)
at branch.Repository.createStream(Repository.java:464)
at branch.CmdRequest.processRequest(CmdRequest.java:66)
at branch.CmdRequest.main(CmdRequest.java:26)

0 votes


Permanent link
My mistake -- createBaselineSet returns a handle, not an item.

The NPE is due to the null first argument (though the spec says this is allowed). Try passing Collections.emptyList() instead.

I've opened 112903: IWorkspaceConnection.createBaselineSet fails with null excludedComponents.

0 votes


Permanent link
excludedComponents can not be null.

IBaselineSetHandle snapshot = stream.createBaselineSet(excludedComponents, "snapshot name", "snapshot comment", false, MONITOR);

0 votes


Permanent link
Yes. Does it work if you pass Collections.emptyList() instead?

0 votes


Permanent link
For future use: It does work with Collections.emptyList()

0 votes


Permanent link
Now it´s deprecated. How do I use the new one?

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: Apr 21 '10, 2:24 p.m.

Question was seen: 8,418 times

Last updated: Jan 20 '16, 2:27 p.m.

Confirmation Cancel Confirm