Accepting baseline update using java api
K M (383●2●52●51)
| asked Aug 12 '10, 1:04 p.m.
edited Jun 03 '16, 5:35 p.m. by David Lafreniere (4.8k●7)
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
How do you accept a baseline update using the java api? 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 |
List changes = workspace.activeChangeSets(component);
changes size equals zero workspace.accept(AcceptFlags.DEFAULT,changes, null, MONITOR); |
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); } |
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, Collections.singletonList(base), sync.incomingChangeSets(),MONITOR); |
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
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.