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

programmaticallypromoting a snapshot

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?

0 votes



6 answers

Permanent link
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?

0 votes


Permanent link
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!

0 votes


Permanent link
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;
}
}

0 votes


Permanent link
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.

0 votes


Permanent link
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

0 votes


Permanent link
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.

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: Dec 07 '09, 10:19 a.m.

Question was seen: 8,902 times

Last updated: Dec 07 '09, 10:19 a.m.

Confirmation Cancel Confirm