It's all about the answers!

Ask a question

Accepting baseline update using java api


0
1
K M (38324246) | asked Aug 12 '10, 1:04 p.m.
edited Jun 03 '16, 5:35 p.m. by David Lafreniere (4.4k7)
How do you accept a baseline update using the java api?

I have a stream which flows to a workspace....

I create a snapshot in the stream.........

If I use the GUI I see that there is a baseline updtae to be accepted
in the workspace.

How do I accept it using the java api?

5 answers



permanent link
Danil Suits (81177) | answered Aug 18 '10, 10:56 a.m.
How do you accept a baseline update using the java api?

I have a stream which flows to a workspace....


IWorkspaceConnection.accept() accepts a list of baselines as an argument. Choose the 1 baseline per component that you want to accept, put it in a list, and pass it in.

From my experiments, you can have multiple incoming baselines for the same component, but you can only accept them one at a time.

See also: http://jazz.net/forums/viewtopic.php?t=12242

permanent link
K M (38324246) | answered Aug 18 '10, 2:32 p.m.
List changes = workspace.activeChangeSets(component);

changes size equals zero

workspace.accept(AcceptFlags.DEFAULT,changes, null, MONITOR);

permanent link
K M (38324246) | answered Aug 20 '10, 10:39 a.m.
IChangeHistorySyncReport sync = workspace.compareTo
(stream,WorkspaceComparisonFlags.INCLUDE_BASELINE_INFO |
WorkspaceComparisonFlags.INCLUDE_EMPTY_BASELINES,
Collections.EMPTY_LIST, MONITOR);

List a = sync.incomingBaselines();
for (Iterator b = a.iterator(); b.hasNext();) {
IBaselineHandle base = (IBaselineHandle) b.next();

workspace.accept(AcceptFlags.DEFAULT,null, sync,
Collections.singletonList(base), sync.incomingChangeSets(),MONITOR);

}

permanent link
K M (38324246) | answered Aug 20 '10, 10:44 a.m.
IChangeHistorySyncReport sync = workspace.compareTo
(stream,WorkspaceComparisonFlags.INCLUDE_BASELINE_INFO |
WorkspaceComparisonFlags.INCLUDE_EMPTY_BASELINES,
Collections.EMPTY_LIST, MONITOR);

List a = sync.incomingBaselines();
for (Iterator b = a.iterator(); b.hasNext();) {
IBaselineHandle base = (IBaselineHandle) b.next();

workspace.accept(AcceptFlags.DEFAULT,stream, sync,
Collections.singletonList(base), sync.incomingChangeSets(),MONITOR);

permanent link
stefano antoniazzi (168711) | answered May 31 '16, 2:55 a.m.
 I had something similar but there are some problems:
1) incomingChangeSets() gives ALL the Change Sets even those pointed by baselines so you get a strange situation with accepted change set coming from accepted baselines appearing again as outgoing. You must use changeHistorySyncReport.incomingChangeSetsAfterBasis()
2) Iterating on all baselines solve the issue of accepting 1 baseline per component but in this way you keep on accepting all the change set at every iteration. So I've a cycle in which I accept 1 baseline at a time (in reverse order because I want to accept first oldest baselines) and finally I accept all change sets on top of the baselines

Your answer


Register or to post your answer.