RTC API to Retrieve appropriate baseline from snapshot and extract files
Hello,
I have a stream that has 4 components (A,B,C,D). What I understand is when I create a snapshot, baselines for all 4 components will be available in the snapshot. I was able to get the API to extract all SNapshots of my stream. But when I select one snapshot, how do I get to the baseline of required component?
What I want to achieve is extract files of the required baseline in the snapshot and copy them to another component.
Any help in this direction will be really appreciated. Thanks!
|
Accepted answer
When you have a snapshot (IBaselineSet) you will need to fetch the full IBaseline objects (from the handles of IBaselineSet.getBaselines()). From there, you can get the component using IBaseline.getComponent(). V D selected this answer as the correct answer
Comments
V D
commented Feb 05 '21, 6:30 a.m.
Thanks David. I am relatively new to this.
I was able to get the baseline component handle...
List<IBaselineHandle> baselineHandlez = snapshot.getBaselines();
List<IBaseline> baselinez = repoConnection.itemManager().fetchCompleteItems(baselineHandlez, IItemManager.DEFAULT, monitor);
IBaseline b1 = baselinez.get(i);
IComponentHandle c1 = b1.getComponent();
IComponent c1my = (IComponent) repoConnection.itemManager().fetchCompleteItem(c1, IItemManager.DEFAULT, monitor);
c1my.getName()
now I need to copy the code in this component baseline to another component...
|
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.
Comments
As a general rule, branching and merging is good, copying is bad. There are of course exceptions, so just for interest's sake, what is the use case that is forcing you to copy files from one component to another?
Test Stream, Development Stream, Integration Stream --- A Snapshot gets created in Dev stream which has multiple baselines...only one component baseline data is required to take it to Integration Stream... I have been asked to develop a UI that makes the user select the Stream ---one snapshot within it ---- one or multiple component baselines within it and copy the content in it to the Stream->Component the user selects in the UI.
The question was "why are they copying files between different components".