It's all about the answers!

Ask a question

IFlowNodeConnection.compareTo results are truncated.

Jay Witherspoon (1368) | asked Feb 11 '14, 3:23 p.m.
When I am comparing a workspace to a stream in the GUI, I get complete results.  However, when I use IFlowNodeConnection.compareTo() with the plain java client it appears the results are truncated.  I have tried both with a monitor and without.  

Is there something that limits the results returned when using the API or a way to get the full set?

3 answers

permanent link
Tim Mok (6.6k38) | answered Feb 11 '14, 4:10 p.m.
It depends on the comparison flags you gave to the compare call. Look at WorkspaceComparisonFlags for the options available.

Jay Witherspoon commented Feb 11 '14, 5:06 p.m.

I am using one of the flags (CHANGE_SET_COMPARISON_ONLY).  The problem is that I am only getting about half of the change sets.  When I compare in the GUI compare,  I get complete the set of changes.  When I use the API, they are all there in the correct order (oldest first) up to a point and it simply stops.  Like some limit has been reached...

I do not see any flags like get all results, etc.  Perhaps I am missing something...

Tim Mok commented Feb 12 '14, 8:16 a.m.

I'm not aware of any limit in the workspace comparison result. Can you provide a code sample or some more detail of what the comparison is supposed to show (ie. incoming/outgoing baselines, incoming/outgoing change sets)?

permanent link
Jay Witherspoon (1368) | answered Feb 12 '14, 9:04 a.m.
Here is the sample code, and I get the exact same results using diffRpt.incomingChangeSets() as I do with the code that loops through the components  (just trying diff things...).  It is strange, it matches the GUI client output exactly until it just stops in the middle...  so, the logic seems valid, the compareTo is not returning the complete set...  This is just quick code, so not robust...

    public List<IChangeSetHandle> findChgSets(IWorkspaceConnection older, IWorkspaceConnection newer, String component) {
        IChangeHistorySyncReport diffRpt;
        try {
            diffRpt = older.compareTo(newer, WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY, Collections.EMPTY_LIST, null);
            List<IChangeSetHandle> result = new LinkedList<IChangeSetHandle>();
            for (Object obj : newer.getComponents()) {
                IComponentHandle handle = (IComponentHandle)obj;
//            result.addAll(diffRpt.incomingChangeSets());
            return result;
        } catch (TeamRepositoryException e) {
            // TODO Auto-generated catch block
        return null;

permanent link
Jay Witherspoon (1368) | answered Feb 12 '14, 3:32 p.m.
I have determined the mistake I made...  There was a workspace with the same name as the stream I wanted to compare with.  And in my code where I was establishing the IWorkspaceConnection, I sent in the wrong type and said it was a workspace.  So, I was comparing to someone's workspace instead of the stream I wanted...  Obviously this workspace was not complete.

We figured this out by using scm compare.  As a side note, scm compare found both the workspace and the stream and so it said it was ambiguous.  However, I told it on the command line it was a stream.  So, somehow scm compare is seeing both workspaces and streams even when indicated it was a stream...  Not a big deal...

Your answer

Register or to post your answer.