Compare Workspaces, what means equal?
my migration utility copies workspaces from one repository to another.
I have almost 400 of them to do.. many will not have changed since last time I did this.
I've coded up the code to compare them first, and only copy if they are different... but there are so manay elements in the compare results object. is there an easy way to sum up all the results?
I have almost 400 of them to do.. many will not have changed since last time I did this.
I've coded up the code to compare them first, and only copy if they are different... but there are so manay elements in the compare results object. is there an easy way to sum up all the results?
Accepted answer
Sam,
Using change sets is fine as long as you are not concerned about baselines. Otherwise, You could include baselines and check whether those lists are empty as well.
Using change sets is fine as long as you are not concerned about baselines. Otherwise, You could include baselines and check whether those lists are empty as well.
Comments
One other answer
I am thinking of just doing changset compare..
private static boolean has_workspacechanged(IWorkspaceConnection prodworkspace, IWorkspaceManager devmgr,
IAuditableHandle Owner, String workspacename) {
boolean result = false;
try
{
// get the workspace connection for this workspace
List<IWorkspaceConnection>wslist = devmgr.findAllWorkspaces(Owner, workspacename, null);
// if there was at least 1
if(wslist.size()>=1)
{
// change set compare only
IChangeHistorySyncReport compresult=prodworkspace.compareTo(wslist.get(0), WorkspaceComparisonFlags.INCLUDE_BASELINE_INFO|WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,new ArrayList< IComponentHandle>(), null);
// if either list is not empty
if(!compresult.incomingChangeSets().isEmpty() || !compresult.outgoingChangeSets().isEmpty() || !compresult.incomingBaselines().isEmpty() || !compresult.outgoingBaselines().isEmpty())
{
// indicate the workspaces are not equal
System.out.println("workspaces are different="+workspacename);
result= true;
}
else
System.out.println("workspaces are identical="+workspacename);
}
else
{
System.out.println("workspace not found = "+workspacename);
result=true;
}
}
catch (TeamRepositoryException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO Auto-generated method stub
return result;
}