Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311056 - CVS: "Compare With / Another Branch or Version... / BASE" unnecessarily calculates the remote changes
Summary: CVS: "Compare With / Another Branch or Version... / BASE" unnecessarily calcu...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: platform-cvs-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: performance
Depends on:
Blocks:
 
Reported: 2010-04-29 12:24 EDT by Arno Unkrig CLA
Modified: 2021-12-01 19:26 EST (History)
3 users (show)

See Also:


Attachments
The (minimal) change that is required on revision 1.12 of org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java (836 bytes, patch)
2010-04-29 12:38 EDT, Arno Unkrig CLA
no flags Details | Diff
The one-liner that fixes the problem (1.68 KB, patch)
2011-10-27 08:44 EDT, Arno Unkrig CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arno Unkrig CLA 2010-04-29 12:24:22 EDT
Build Identifier: 20090621-0832

There can be no remote changes if you compare against the BASE version. However, for huge sets of resources, that calculation can generate a lot of unnecessary network traffic and cost a lot of time.

The optimization is straightforward: Iff the target version is BASE, then determine only the local changes and do not merge in the (empty) set of remote changes. (The latter is only necessary when comparing with non-BASE versions.)

I will attach a patch.

Looking at the ECLIPSE CVS repo, the problem has been there for ages (at least since version 3.2), maybe always.

Reproducible: Always

Steps to Reproduce:
1. Select a (CVS-shared) resource in the Navigator
2. Hit "Compare With / Another Branch or Version... / BASE"
3. A CVS update is executed on the repository (bad :-( )
4. The "Synchronize" view is populated
Comment 1 Arno Unkrig CLA 2010-04-29 12:38:20 EDT
Created attachment 166518 [details]
The (minimal) change that is required on revision 1.12 of org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java

This patch is in CONTEXT DIFF format, and is trivial: A one-line change in line 328.
Comment 2 Arno Unkrig CLA 2010-04-29 12:54:37 EDT
Also it may be worth considering to add a popup menu Entry

  "Compare With / Base revision"

as a shortcut for

  "Compare With / Another Branch or Version... / BASE"

, which is quite hard to find.

(Actually I built a helper plugin which does exactly that, as an interim solution for my company.)
Comment 3 Eclipse Webmaster CLA 2010-04-29 13:35:04 EDT
I'm pretty sure this belongs to the Platform team.  Apologies if that is not the case.

-M.
Comment 4 Arno Unkrig CLA 2010-06-14 03:33:10 EDT
Hello... is there anybody out there? This is a very small, yet useful one!
Comment 5 Arno Unkrig CLA 2011-09-27 11:14:37 EDT
Can YOU help?
Comment 6 Arno Unkrig CLA 2011-09-27 12:13:27 EDT
The patch I provided is wrong. Instead, in "org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java" the lines

private IStatus refresh(IResource resource, int depth, IProgressMonitor monitor) {
    monitor = Policy.monitorFor(monitor);
    try {
        monitor.beginTask(null, 100);
        Set allChanges = new HashSet();
        if (getResourceComparator().isThreeWay()) {
            IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 25));
            allChanges.addAll(Arrays.asList(baseChanges));
        }
        IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75));
        allChanges.addAll(Arrays.asList(remoteChanges));
        IResource[] changedResources = (IResource[]) allChanges.toArray(new IResource[allChanges.size()]);
        fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources));
        return Status.OK_STATUS;
        ...

should be changed to something like

        ...
        if (getTag() != CVSTag.BASE) {
            IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75));
            allChanges.addAll(Arrays.asList(remoteChanges));
        }
Comment 7 Arno Unkrig CLA 2011-10-07 08:35:55 EDT
Who's going to take this one from the CVS inbox?
Comment 8 Tomasz Zarna CLA 2011-10-11 08:17:54 EDT
Krzysztof, could you take a look at Arno's patch? Compare with Base is your baby ;) 

Arno, please update the patch with comment 6 in the meantime.
Comment 9 Arno Unkrig CLA 2011-10-27 08:44:35 EDT
Created attachment 206069 [details]
The one-liner that fixes the problem

I added the patch that fixes the problem... however I am not absolutely sure that it is correct - code review required!
Comment 10 Eclipse Genie CLA 2021-12-01 19:26:08 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.