It's all about the answers!

Ask a question

SCM versus API


eric nolmans (281512) | asked Nov 23 '11, 10:27 a.m.
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

4 answers



permanent link
Michael Valenta (3.7k3) | answered Dec 01 '11, 9:19 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
It seems my previous post was not accurate. The code in the com.ibm.team.scm.client package is API.

permanent link
Michael Valenta (3.7k3) | answered Nov 29 '11, 8:49 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.

permanent link
Sterling Bates (2311612) | answered Nov 26 '11, 2:15 p.m.
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.

permanent link
Michael Valenta (3.7k3) | answered Nov 24 '11, 9:10 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I do not believe that there is API available to do this so the command line would be the way to go.

Your answer


Register or 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.