使用纯Java比较RTC / Jazz中的两个基线

我尝试在纯Java中以编程方式比较一个流的两个快照…

第1步:获取我的信息流(工作中)

IWorkspaceConnection stream = null;
List<IWorkspaceConnection> list = RtcAdapter.inst().getStreams(); //my library
for (IWorkspaceConnection connection: list){
    if (connection.getName().equalsIgnoreCase("myStreamName") ){
        stream = connection;
        break;
    }
}//now we have found our stream

步骤2:获取基准(有效)

List<IBaselineSet> snapShotList = 
    RtcAdapter.inst().getSnapShotsFromStream(stream);

IBaselineSet snapShot0 = null;
IBaselineSet snapShot1 = null;

for (IBaselineSet snapShot: snapShotList){
    if (snapShot.getName().equalsIgnoreCase("mySnapShotName0") ){
        snapShot0 = snapShot;
    }
    if (snapShot.getName().equalsIgnoreCase("mySnapShotName1") ){
        snapShot1 = snapShot;
    }
}//now we've got also my two snapShots

步骤3:相互比较(不起作用)

IUpdateReport report = 
    workspaceManager.compareBaselineSetConfigurations(
        snapShot0, snapShot0, stream.getComponents(), monitor);

我的报告是空的…-讨厌-

report=com.ibm.team.scm.common.internal.dto.impl.UpdateReportImpl@1de5a20(stateBefore:< unset&gt ;, stateAfter:< unset>)

我也试图获取ChangeHistorySyncReport …

IChangeHistorySyncReport report = 
    workspaceManager.compareBaselineSets(
        snapShot0, snapShot1, componentList(stream), monitor);

报告也为空…

那么如何创建适当的报告?或如何比较两个基准? (我究竟做错了什么?

report.getAffectedComponents()返回一个空数组,report.getModifiedComponents()也返回

更新
据我所知,我现在必须检查ChangeHistorySyncReport …,当我打印报告时会说:

com.ibm.team.scm.common.internal.dto.impl.ChangeHistorySyncReportImpl@150f091(localTime:< unset&gt ;, remoteTime:< unset&gt ;, compareFlags:< unset>)

这使我的问题更深-我如何设置更好的CompareFlags?

解决方法:

上帝花了我好几年….

但首先要做的是:使用IChangeHistorySyncReport而不是I完全是正确的
IUpdateReport …

那怎么了

IWorkspaceConnection stream; //is not null, already instantiated somewhere else
IBaselineSet bl0 = (IBaselineSet) 
    itemManager.fetchCompleteItem(baseLineHandle0, IItemManager.DEFAULT, monitor);
IBaselineSet bl1 = (IBaselineSet)
    itemManager.fetchCompleteItem(baseLineHandle1, IItemManager.DEFAULT, monitor);
IChangeHistorySyncReport report = 
    workspaceManager.compareBaselineSets(bl0, bl1, getComponentHandles(stream), monitor);

简单的代码更改即可解决问题

//have a close look: 3.rd param is now null!!
IChangeHistorySyncReport report = 
    workspaceManager.compareBaselineSets(bl0, bl1, null, monitor); 

顺便说一句,当我浏览报告时,还有另一个棘手的部分:

System.out.println("report: "+report );    
System.out.println("incoming: "+report.incomingChangeSets() );

output:
report = com.ibm.team.scm.common.internal.dto.impl.ChangeHistorySyncReportImpl@127c1ae (localTime: <unset>, remoteTime: <unset>, compareFlags: <unset>)
incoming []

乍一看看上去是空的-但深入研究发现我只需要索要report.outgoingChangeSets()即可带来很大的(预期)变化…

但是当我交换基准workspaceManager.compareBaselineSets(bl1,bl0,null,monitor)时;然后

> report.outgoingChangeSets()为空,
> report.incomingChangeSets()带来正确的结果!

更新:

使用比较基准方法,我现在可以提供几个组件的完整差异!!!

上一篇:关于在Arduino下STM32编程——RTC函数解析


下一篇:java-为什么我的待处理更改未在RTC中显示?