Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 138853 - [Sync View] Compare editor opened by Synchronize view only shows right author
Summary: [Sync View] Compare editor opened by Synchronize view only shows right author
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: CVS (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-27 04:15 EDT by Dani Megert CLA
Modified: 2010-09-14 05:34 EDT (History)
4 users (show)

See Also:


Attachments
Picture showing missing author information (39.89 KB, image/png)
2006-04-27 04:19 EDT, Dani Megert CLA
no flags Details
Patch_v01 (6.33 KB, patch)
2008-12-02 06:29 EST, Pawel Pogorzelski CLA
no flags Details | Diff
Fix (9.15 KB, patch)
2010-07-21 08:21 EDT, Dani Megert CLA
no flags Details | Diff
Fix (16.65 KB, patch)
2010-08-13 09:55 EDT, Dani Megert CLA
no flags Details | Diff
Fix (22.58 KB, patch)
2010-08-16 12:24 EDT, Dani Megert CLA
no flags Details | Diff
Fix (22.34 KB, patch)
2010-08-24 11:09 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-04-27 04:15:44 EDT
N20060426-0010

Check Window > Preferences > Team > "Show the file author in compare editor" and then click on a file in the Synchronize view
==> only right side shows author information (see attached picture).
Comment 1 Dani Megert CLA 2006-04-27 04:19:23 EDT
Created attachment 39638 [details]
Picture showing missing author information
Comment 2 Michael Valenta CLA 2006-04-27 09:41:15 EDT
You can see the other author by revealing the ancestor pane. 

The problem here is that the local may be modified. What authgor should we show in tat case? The authore of the base or the local user?
Comment 3 Dani Megert CLA 2006-04-27 09:43:49 EDT
Well, the same argument holds for the revision, right? And since the revision is shown I think it is clear to where the author belongs.
Comment 4 Michael Valenta CLA 2006-04-27 10:44:13 EDT
Perhaps. I have verified that the current behavior is the same as it was in 3.1. Since it is not a refgression, we will defer the issue to a later release.
Comment 5 Tomasz Zarna CLA 2007-10-09 09:17:34 EDT
Having the preference on and using N20071008-0010 I'm not able to locate the author on either left (local) nor right side of the compare editor. 
Comment 6 Tomasz Zarna CLA 2007-10-09 09:44:06 EDT
More details about the issue can be found in bug 80577, I would even mark it as a duplicate.
Comment 7 Dani Megert CLA 2007-10-09 11:22:10 EDT
>More details about the issue can be found in bug 80577, I would even mark it as
>a duplicate.
They are not really duplicates (at least not from a user point of view - didn't look at your code to check whether it really boils down to the same PR). The big difference is that a comparison opened via Sync view never shows the author on the left side:
1. make a change and save
2. click on the outgoing change in the Sync view
==> no author on the left side

The other bug is about missing the author on both sides using the Repo view
Comment 8 Pawel Pogorzelski CLA 2008-12-02 06:29:39 EST
Created attachment 119252 [details]
Patch_v01

Tom, please comment on the patch.
Comment 9 Pawel Pogorzelski CLA 2008-12-02 10:47:09 EST
Tomasz, the patch provided doesn't consider all the cases. Please hold on with the review until I fix it.
Comment 10 Dani Megert CLA 2008-12-17 06:41:36 EST
Looking forward to see this fixed ;-)
Comment 11 Dani Megert CLA 2010-07-21 07:46:04 EDT
I'd like to finish this.

>Tomasz, the patch provided doesn't consider all the cases.
Pawel, can you tell me which cases you think are missing?
Comment 12 Dani Megert CLA 2010-07-21 08:20:49 EDT
Those might be possible candidates but I don't think local resources are involved here (at least I could not trigger a test case in the UI):
    CVSParticipant.updateLabelsForCVS(...)
    CVSCompareEditorInput.getLabel(...)
    ResourceCompareInputChangeNotifier.CompareInputLabelProvider

For now I'd like to commit a polished version of your patch (fixes some possible NPEs, a little bit of performance tuning, bundle version and @since tag updates).

I think we can raise new bugs if we find remaining issues.
Comment 13 Dani Megert CLA 2010-07-21 08:21:35 EDT
Created attachment 174837 [details]
Fix
Comment 14 Pawel Pogorzelski CLA 2010-07-22 11:20:43 EDT
(In reply to comment #11)
> I'd like to finish this.
> 
> >Tomasz, the patch provided doesn't consider all the cases.
> Pawel, can you tell me which cases you think are missing?

Just sync a project and open a comparison from the Sync view.
Comment 15 Dani Megert CLA 2010-07-24 03:55:43 EDT
>Just sync a project and open a comparison from the Sync view.
Indeed. This would have to be fixed in
ResourceCompareInputChangeNotifier.CompareInputLabelProvider

It looks like for every different scenario to open a compare editor there are different editor inputs :-(

Using Compare Current with x.y in the History view also doesn't fill in the author. It even doesn't fill in the revision of the local file. This would have to be fixed in CompareFileRevisionEditorInput.

To proceed we have to add getAuthor() to LocalResourceTypedElement which is used in both of the above cases.

Tomasz or Pawel, is there an easy way to get or create the SyncInfo for the local resource and then use SyncInfo.getLocalAuthor(IProgressMonitor) that we add with the patch? Or is there even a simpler way?
Comment 16 Tomasz Zarna CLA 2010-07-27 08:38:51 EDT
(In reply to comment #15)
> It looks like for every different scenario to open a compare editor there are
> different editor inputs :-(

Welcome to our world.

> Tomasz or Pawel, is there an easy way to get or create the SyncInfo for the
> local resource and then use SyncInfo.getLocalAuthor(IProgressMonitor) that we
> add with the patch? Or is there even a simpler way?

The SyncInfo doesn't have the getLocalAuthor method you mentioned. Is this something you would like to add as well? My first impression looking at the related code is that we should try to get an implementation of IFileRevision in LocalResourceTypedElement. Have you considered this? The IFileRevision interface has a handy getAuthor() method.
Comment 17 Dani Megert CLA 2010-07-27 08:48:18 EDT
Did you read my previous comment at all? ;-)

>The SyncInfo doesn't have the getLocalAuthor method you mentioned
From previous comment: This is part of the currently attached patch (Fix).

>LocalResourceTypedElement. Have you considered this? 
From previous comment: To proceed we have to add getAuthor() to LocalResourceTypedElement


Yes, I tried to implement getAuthor() using the getLocalAuthor() from the patch but got no luck. Maybe we can move the whole code that's currently (in patch) in SyncInfo.getLocalAuthor() into LocalResourceTypedElement but I didn't check whether that also covers the case from the patch.
Comment 18 Tomasz Zarna CLA 2010-07-27 11:04:55 EDT
(In reply to comment #17)
> Did you read my previous comment at all? ;-)

Oops, my cheap trick didn't work :) Seriously, I haven't noticed the patch you submitted. Apologies.
Comment 19 Dani Megert CLA 2010-07-27 11:24:29 EDT
>Seriously, I haven't noticed the patch you submitted. Apologies.
It's Pawel's patch with some enhancements.
Comment 20 Tomasz Zarna CLA 2010-08-12 06:27:44 EDT
(In reply to comment #15)
> Tomasz or Pawel, is there an easy way to get or create the SyncInfo for the
> local resource and then use SyncInfo.getLocalAuthor(IProgressMonitor) that we
> add with the patch?

CVSWorkspaceRoot.getCVSResourceFor(resource).getSyncInfo().

Dani, I've applied the latest patch and check the following scenarios:
* Compare with > Latest from HEAD, authors on both sides
* Non-model Sync View: Open in Compare Editor, authors on both sides
* Model Sync View: Open in Compare Editor, author on the left side is missing
* Repo View: Compare, authors on both sides
* History View: comparing two remote revs, authors on both sides
* History View: comparing Current with x.y, author on the left side is missing
* History View: comparing remote rev with local, n/a (at least it current, but that's the case above)
* History View: comparing local revs, n/a
* Compare With > Each Other, n/a? do you want to display authors here as well? of course, only when comparing shared files

Did I miss anything? I skipped comparisons made in dialogs, I treat them as obsolete.
Comment 21 Dani Megert CLA 2010-08-12 10:45:10 EDT
>Did I miss anything?
See comment 14.
Comment 22 Tomasz Zarna CLA 2010-08-13 05:20:52 EDT
I'm sorry, but isn't "sync a project and open a comparison from the Sync view" (comment 14) the same as "Model Sync View: Open in Compare Editor" (comment 20)?
Comment 23 Dani Megert CLA 2010-08-13 05:33:08 EDT
>I'm sorry, but isn't "sync a project and open a comparison from the Sync view"
>(comment 14) the same as "Model Sync View: Open in Compare Editor" (comment
>20)?
Looks like they are not. At least when you open the compare editor from the Sync view it's missing the left author (with the patch) as a different editor input is used.
Comment 24 Dani Megert CLA 2010-08-13 09:55:25 EDT
Can you reproduce the missing author on the left?

>CVSWorkspaceRoot.getCVSResourceFor(resource).getSyncInfo().
That does not return an org.eclipse.team.core.synchronize.SyncInfo.


I have a working solution in place (see latest patch) but fetching the workspace author takes quite some time. I use this code:

RepositoryProvider provider= 
    RepositoryProvider.getProvider(getResource().getProject());
IFileRevision revision= 
    provider.getFileHistoryProvider().getWorkspaceFileRevision(getResource());
revision= revision.withAllProperties(monitor);
author= revision.getAuthor();

This call: revision.withAllProperties(monitor) is very slow. Any idea how we can get the local revision with filled properties faster? The code needs to be in Team not CVS.
Comment 25 Dani Megert CLA 2010-08-13 09:55:49 EDT
Created attachment 176554 [details]
Fix
Comment 26 Dani Megert CLA 2010-08-13 10:03:12 EDT
>This call: revision.withAllProperties(monitor) is very slow.
1 to 2 seconds.
Comment 27 Dani Megert CLA 2010-08-16 12:23:33 EDT
>>This call: revision.withAllProperties(monitor) is very slow.
>1 to 2 seconds.
OK, I did some more analyzes and tests and the originally proposed (and incomplete) patch from Pawel has the same issue but it's not noticed quickly because the whole editor fetches all its data and then shows everything together including the authors ==> opening of the editor gets slower. On the scenario via Synchronize view one sees the delay better because there the authors are updated in the background while the compare editor is already present.
==> Any fix can delay opening the compare editor via Compare With. To avoid this we would have to rework the code like it is done in the scenario where the editor is opened via Synchronize view but that's out of scope. However, I have improved the code to check the revision (content id) and avoid to fetch the author twice for the same revision (similar to the code in ResourceDiffCompareInput.propogateAuthorIfSameRevision(FileRevisionTypedElement, FileRevisionTypedElement). Also, I've improved the code in ResourceCompareInputChangeNotifier to only start one thread instead instead of one per left/right/ancestor.

Remaining issue: the left author is still not shown for the case where one compares 'Current with x.y' in the History view.

Can someone please review the patch and provide feedback about the direction? If it's good I can implement the missing scenario. Thanks.
Comment 28 Dani Megert CLA 2010-08-16 12:24:14 EDT
Created attachment 176688 [details]
Fix
Comment 29 Tomasz Zarna CLA 2010-08-17 06:53:04 EDT
Since I'm the only one in the outpost at the moment I suppose I'll be that "someone" :) So, here are my comments:
* the fix doesn't work when opening comparison for an incoming addition (most probably because it sets fireEvent to false (was true) when no author is found for the left side[1])
* I guess you can use getLocalContentIdentifier() in getLocalAuthor()[2] if you want to get the localRevision
* in the fetchAuthor[3] method you could use Utils.getHistoryProvider(getResource())
* you missed "c" in "@since 3.6" for getLocalAuthor[2]

I haven't found anything else - other then the above, it works fine to me.

[1] org.eclipse.team.internal.ui.mapping.ResourceDiffCompareInput.updateAuthorInfo(IProgressMonitor)
[2] org.eclipse.team.internal.ccvs.core.CVSSyncInfo.getLocalAuthor(IProgressMonitor)
[3] org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement.fetchAuthor(IProgressMonitor)
Comment 30 Dani Megert CLA 2010-08-24 11:09:01 EDT
Created attachment 177328 [details]
Fix

>Since I'm the only one in the outpost at the moment I suppose I'll be that
>"someone" :) 
Thanks!

>* the fix doesn't work when opening comparison for an incoming addition (most
>probably because it sets fireEvent to false (was true) when no author is found
>for the left side[1])
Fixed.

>* you missed "c" in "@since 3.6" for getLocalAuthor[2]
Fixed.

>* in the fetchAuthor[3] method you could use
>Utils.getHistoryProvider(getResource())
Done.

>* I guess you can use getLocalContentIdentifier() in getLocalAuthor()[2] if you
>want to get the localRevision
Not done. This is done on purpose for performance reasons.


Committed this to HEAD.
Comment 31 Dani Megert CLA 2010-08-24 11:19:10 EDT
Note that sometimes it shows "Local File 0" on the left side. This is has not been introduced by the fix, see bug 323509 for details.
Comment 32 Dani Megert CLA 2010-08-24 11:48:38 EDT
>Using Compare Current with x.y in the History view also doesn't fill in the
>author.
Fixed that in HEAD (CompareFileRevisionEditorInput).
Comment 33 Deepak Azad CLA 2010-09-14 05:34:01 EDT
Verified for 3.7M2 on Linux with I20100913-1800.