create a new stream out of a snapshot using the server side api
Hello
I want to create a stream based on a snapshot. IScmService has the method "createWorkspaceFromBaselineSet" to create a workspace. Is there a similar method for streams available? If not what needs to be done to create a stream? Thanx, Steffen
showing 5 of 7
show 2 more comments
|
2 answers
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.
Comments
The client API to set a baseline I have used looks looks this:
This is from the example in https://rsjazz.wordpress.com/2013/09/30/delivering-change-sets-and-baselines-to-a-stream-using-the-plain-java-client-libraries/
in the server side api the IScmService class provides a method called "replaceComponent" which seams to provide the same functionality as the client side "replaceComponent". Unfortunately the method is marked as deprecated and IScmService.updateComponents2 should be used instead.
I changed the code to call updateComponents2:
IBaselineHandle currentBaseline = baselineIterator.next();
IComponentOpDescriptor desc = ComponentOpDescriptor.FACTORY.addComponent(currentComponent, currentBaseline ,false);
scmService.updateComponents2(w, null, new IComponentOpDescriptor[] { desc }, true, false, IScmService.DELTA_PER_INVOCATION, null, null);
this fails wit an exception
com.ibm.team.repository.common.TeamRepositoryException: Component 'the first one Default Component' is already in workspace
at com.ibm.team.scm.service.internal.utils.IExceptionFactory$1.createException(IExceptionFactory.java:52)
at com.ibm.team.scm.service.internal.utils.IExceptionFactory$1.createException(IExceptionFactory.java:57)
at com.ibm.team.scm.service.internal.utils.WorkspaceUtils.addComponent(WorkspaceUtils.java:1341)
at com.ibm.team.scm.service.internal.ScmServiceInternal.updateComponents2(ScmServiceInternal.java:4848)
at com.ibm.team.scm.service.internal.ScmService$85.run(ScmService.java:3950)
at com.ibm.team.scm.service.internal.AbstractScmService$2.run(AbstractScmService.java:431)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:488)
What are you actually trying to do here? What is the use case? If it is server API, in which context do you run?
we want to create a number of "maintenance streams" based on snapshots in development streams on a regular base. The maintenance streams differ in the number of components and also have functional dependencies to each other and to work items. So we need some checking before the streams are created and we to set a number of attributes for each stream. Of cause the creation of the "maintenance streams" could be done via the eclipse gui or from the java api. But both cases have there own drawbacks. We ended up with a rest service with some get functions to query information in RTC and a post function to create the new streams.