How do you create a snapshot using the java api?
8 answers
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);
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);
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);
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)
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)
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.
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.