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

SCM versus API

using SCM I can use the compare subcommand to display the incoming changes between a snapshot and a stream;

scm compare snapshot "GENERATED FOR RE7 on 20110919-14:15" stream CICSRE7 -r https://localhost:9443/ccm -r Administrator -I wfs -D "EEE, d MMM yyyy HH:mm:ss Z"


but is it possible to do the same thing using the API, I suppose yes but how?

Eric

0 votes



4 answers

Permanent link
I do not believe that there is API available to do this so the command line would be the way to go.

0 votes


Permanent link
Yup, there is, but it's certainly more involved. You can use the following to query for a snapshot:
IBaselineSetSearchCriteria query = IBaselineSetSearchCriteria.FACTORY.newInstance();

query.setExactName(name);

IWorkspaceManager client = ...
List<IBaselineSetHandle> results = client.findBaselineSets(query, Integer.MAX_VALUE, null);
if (results.size() > 0) {
IBaselineSet snapshot = (IBaselineSet)itemManager.fetchCompleteItem(
results.get(0),
IItemManager.DEFAULT,
null);
return snapshot;
}


Then use this code to get the current baseline for a component in the workspace:
IWorkspaceConnection conn = ...

IHistoricBaselineIterator history = conn.getBaselinesInHistory(componentHandle, 1, null);
if (history == null || history.getBaselines().size() == 0)
return null;
IBaseline baseline = (IBaseline)itemManager.fetchCompleteItem(history.getBaselines().get(0), IItemManager.DEFAULT, null);


Then this to generate a comparison report:
IWorkspaceManager mgr = ...

IBaselineConnection baselineConn = mgr.getBaselineConnection(baseline, null);
IChangeHistorySyncReport report = baselineConn.compareTo(otherBaselineHandle, null);


The IChangeHistorySyncReport class has all the methods to pull diff changesets. Getting a full changeset is very easy, and the class is uncomplicated:
IChangeSet cs = (IChangeSet)itemManager.fetchCompleteItem(handle, IItemManager.DEFAULT, null);


Hope this helps.

0 votes


Permanent link
While the above code should do what you want, I think it is worth mentioning that it is not official API so you can not assume that it will work when used against future versions of RTC.

0 votes


Permanent link
It seems my previous post was not accurate. The code in the com.ibm.team.scm.client package is API.

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
× 10,939

Question asked: Nov 23 '11, 10:27 a.m.

Question was seen: 7,939 times

Last updated: Nov 23 '11, 10:27 a.m.

Confirmation Cancel Confirm