Sunday, October 11, 2009

A couple of baseline-related queries

1. List specific project's versions that are part of any baseline:
ccm query "versions_in_a_baseline('<project_spec>')"
e.g.
$ ccm query "versions_in_a_baseline('MyProj_x#0.1_20091008:project:1')"
1)
MyProj_x#0.1_20090929 integrate user1 project MyProj_x 1 185777
2)
MyProj_x#0.1_20091004 integrate user2 project MyProj_x 1 185777
3)
MyProj _x#0.1_20091008 integrate user1 project MyProj_x 1 185777
4)
MyProj_x#MyProj_x_0.1_20090811 integrate user3 project MyProj_x 1 185777
5)
MyProj_x#MyProj_x_0.1_20090819 integrate user3 project MyProj_x 1 185777

2. List all projects in a specific baseline:
ccm baseline -show projects <baseline name>
e.g.
ccm baseline -show projects MyProj_20091008_190808 -u -f %objectname
MyProj_x#0.1_20091008:project:1

3. Show the baseline that the project is associated with:
ccm query -type project -name <proj name> -version <proj version> -f %in_baseline -u
e.g.
$ ccm query -type project -n MyProj_x -v 0.1_20091008 -f %in_baseline -u
MyProj_20091008_190808

4. Find the latest baseline created on a specific project:
ccm query "has_successor('project spec') and status='integrate'" -u -f %in_baseline
e.g. $ ccm query "has_successor('MyProj_x#0.1:project:1') and status='integrate'" -u -f %in_baseline
MyProj_20091008_190808
And combining some of above together:
Here we need to find the predecessor of the current prep project and display the name of the baseline it is part of (instead of the project object name):
This is how we would display the latest project that is in the baseline:
$ ccm query "has_successor('MyProj_x#0.1:project:1') and status='integrate'" -u -f %objectn ame
MyProj_x#0.1_20091008:project:1
And this is how we would show the project's "parent" baseline:
ccm query -type project -n proj_name -v proj_ver -f %in_baseline -u
$ ccm query -type project -n MyProj_x -v 0.1_20091008 -f %in_baseline -u
Now together:
ccm query "has_successor('proj_spec') and status='integrate'" -u -f %in_baseline

$ ccm query "has_successor('
MyProj_x#0.1:project:1') and status='integrate'" -u -f %in_baseline
MyProj_20091008_190808

Enjoy!