Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Accepted answer

Permanent link
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.
sam detweiler selected this answer as the correct answer

0 votes

Comments

thanks.. my 'assumption' is that even if one workspace has baselines different from another,  it also has changesets different from another.

changeset contained in a baseline are still changesets.  I don't care what is in the changeset, just the list of things that are different is all I am looking for.

A workspace can have baselines that another workspaces does not have, while having exactly the same change sets as the other workspace.   For example, start with two workspaces that have the same change sets, and execute a "create baseline" operation in the first workspace.   The two workspaces will continue to have the same change sets, but the first workspace will have a baseline that the second workspace does not have.

using both your nudges. I added code to compare for baselines and my previous changeset only checks would have misreported.. 


thank you. 

I updated the code in the prior comment to the latest..


One other answer

Permanent link
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;
}

0 votes

Comments

if I compare just changesets is that enough? will changesets in new baselines also be detected?

no opportunity to test before I have to use this code Friday night

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 1,202

Question asked: Feb 07 '14, 6:09 p.m.

Question was seen: 5,792 times

Last updated: Feb 21 '14, 4:36 p.m.

Confirmation Cancel Confirm