It's all about the answers!

Ask a question

programmaticallypromoting a snapshot


David Rostocil (911410) | asked Dec 07 '09, 10:19 a.m.
I would like to programmatically promote a good build snapshot from the build workspace to the default flow target (a stream). I have IWorkspaceConnection objects to both the build workspace and the stream and I can remove the IBaselineSet from the build workspace with:

wsConn.removeBaselineSet(set, monitor);


However a cannot add the IBaselineSet to the stream with:

wsConn.addBaselineSet(set, monitor);


Is this the correct way to do a snapshot promotion? Why am I not able to see a snapshot added to a stream with the addBaselineSet method?

6 answers



permanent link
Nick Edgar (6.5k711) | answered Dec 09 '09, 4:26 p.m.
JAZZ DEVELOPER
That should work just fine. You don't even need to remove the snapshot first -- it can be associated with multiple workspaces/streams.

The Promote action in the Search view when you Show Snapshots is implemented this way.

What error, if any, are you getting?

permanent link
David Rostocil (911410) | answered Dec 09 '09, 5:35 p.m.
That should work just fine. You don't even need to remove the snapshot first -- it can be associated with multiple workspaces/streams.

The Promote action in the Search view when you Show Snapshots is implemented this way.

What error, if any, are you getting?


I actually figured out that I didn't need to make the call to remove and I only needed to do an add. Thanks for your help!

permanent link
David Rostocil (911410) | answered May 07 '10, 9:04 a.m.
I had a request for a code snippet on how this was actually accomplished. Note that this snippet is from a task that extends the AbstractTeamBuildTask class.


IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(getTeamRepository());
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspace, getProgressMonitor());

IFlowTable flowTable = workspaceConnection.getFlowTable();
IFlowEntry flowEntry = flowTable.getCurrentDeliverFlow();
IWorkspace flowWorkspace = (IWorkspace)getTeamRepository().itemManager().fetchCompleteItem(flowEntry.getFlowNode(), IItemManager.REFRESH, getProgressMonitor());
IWorkspaceConnection flowConnection = workspaceManager.getWorkspaceConnection(flowWorkspace, getProgressMonitor());

List<IBaselineSet> snapshots = SourceControlUtility.getBaselineSets(getTeamRepository(), workspaceConnection, getProgressMonitor());
for(IBaselineSet set : snapshots){
if(set.getName().equals(snapshotName)){
flowConnection.addBaselineSet(set, getProgressMonitor());
break;
}
}

permanent link
Nick Edgar (6.5k711) | answered May 07 '10, 11:01 a.m.
JAZZ DEVELOPER
This can also be done using the SCM command line (under scmtools in the RTC eclipse client install).

./scm.sh help snapshot promote
Help on snapshot promote
Promote snapshots to a workspace or stream. This will associate the snapshots with the workspace or stream.

Aliases: pr

Usage: scm snapshot promote <workspace> <snapshots>
workspace - Workspace or stream where the snapshots are promoted to.
snapshots - Snapshots to be promoted to the workspace or stream.

Options:
-P arg - Password for repository.
-r arg - URI specifying the location of repository.
-u arg - Username for repository.

permanent link
jordi levant (11) | answered May 08 '10, 8:41 p.m.
Can you tell me what scm version you are using? I'm seeing:
Unknown subcommand "snapshot"

Here's my version:
/build/tools/IBM/TeamConcert/scmtools/eclipse/scm version
com.ibm.team.filesystem.cli.tools, version 2.0.2.I200910232005
Subcommands: tools.verify tools.validate tools.echo.stdin tools.configvalue

com.ibm.team.filesystem.cli.client, version 2.0.2.I200912072036
Subcommands: load login logout create create/workspace create/baseline create/changeset create/snapshot create/component changeset changeset/comment changeset/close changeset/relocate changeset/associate changeset/disassociate changeset/suspend changeset/resume daemon daemon/start daemon/stop change-target change-target/workspace change-target/component list list/workspaces list/projectareas list/teamareas list/streams list/components list/remotefiles list/credentials list/daemons list/snapshots list/locks list/properties checkin accept deliver status conflicts resolve move lastmod share discard undo compare history diff repair workspace workspace/add-components workspace/remove-components workspace/replace-components property property/list property/get property/set lock lock/list lock/acquire lock/release annotate

com.ibm.team.filesystem.cli.core, version 2.0.2.I200912032141
Subcommands: help version

permanent link
David Rostocil (911410) | answered May 09 '10, 11:25 a.m.
Can you tell me what scm version you are using? I'm seeing:
Unknown subcommand "snapshot"

Here's my version:
/build/tools/IBM/TeamConcert/scmtools/eclipse/scm version
com.ibm.team.filesystem.cli.tools, version 2.0.2.I200910232005
Subcommands: tools.verify tools.validate tools.echo.stdin tools.configvalue

com.ibm.team.filesystem.cli.client, version 2.0.2.I200912072036
Subcommands: load login logout create create/workspace create/baseline create/changeset create/snapshot create/component changeset changeset/comment changeset/close changeset/relocate changeset/associate changeset/disassociate changeset/suspend changeset/resume daemon daemon/start daemon/stop change-target change-target/workspace change-target/component list list/workspaces list/projectareas list/teamareas list/streams list/components list/remotefiles list/credentials list/daemons list/snapshots list/locks list/properties checkin accept deliver status conflicts resolve move lastmod share discard undo compare history diff repair workspace workspace/add-components workspace/remove-components workspace/replace-components property property/list property/get property/set lock lock/list lock/acquire lock/release annotate

com.ibm.team.filesystem.cli.core, version 2.0.2.I200912032141
Subcommands: help version


From Nick: It was only added in 3.0 M4: Want a promote snapshot for CLI (84638) However, you should be able to use the 3.0 M4 SCM CLI against a 2.0.0.x server. 3.0 M5 has version compatibility issues though.

Your answer


Register or to post your answer.