Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354932 - Replace With not considering model providers.
Summary: Replace With not considering model providers.
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 358621
Blocks: 354474
  Show dependency tree
 
Reported: 2011-08-17 05:50 EDT by Laurent Goubet CLA
Modified: 2012-03-02 11:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Goubet CLA 2011-08-17 05:50:42 EDT
Right-clicking a resource in the workspace and selecting "Replace With >
History..." pops up a dialog displaying all distinct revision of that file. A
double-click on any of these revisions triggers a comparison and displays the
changes between the current version of the file and the selected revision of
that file.

Problem is : this action does not consider logical models for the comparison.
If the file is part of a model (as returned by the ModelProvider), its whole
model should be taken into account for the comparison.

Furthermore, the logical model should be taken into account for the actual replacement : replacing one of the file that is part of a logical model without touching the others corrupts the whole model. Note that all "Replace With" actions suffer from this second issue, not only the "Replace With > Local History..." one.
Comment 1 Benjamin Muskalla CLA 2011-08-17 05:55:07 EDT
Laurent, at the least the actual replacement should be handled by http://egit.eclipse.org/r/#change,3813 - but the comparison still doesn't consider the logical mode, that's right.
Comment 2 Laurent Goubet CLA 2011-08-17 06:43:44 EDT
Benjamin, I confess haven't tested the actual replacement before raising this bug, I'll do it now and confirm whether this part is actually fixed with your changes :).
Comment 3 Laurent Goubet CLA 2011-09-29 05:17:09 EDT
Benjamin,

Just tested this with the latest code from the github egit repository ... and got the following exception when using Replace With > Git Index and actually clicking "finish". I'll switch to the eclipse repo instead of git to see whether that changes anything.

java.lang.NullPointerException
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.refresh(GitResourceVariantTreeSubscriber.java:141)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.refresh(SubscriberResourceMappingContext.java:167)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.ensureRefreshed(SubscriberResourceMappingContext.java:207)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.fetchRemoteContents(SubscriberResourceMappingContext.java:96)
	at org.eclipse.emf.compare.logical.model.EMFResourceMapping.getTraversals(EMFResourceMapping.java:158)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.addMappingsToScope(SynchronizationScopeManager.java:389)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.internalPrepareContext(SynchronizationScopeManager.java:200)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.access$0(SynchronizationScopeManager.java:187)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager$1.run(SynchronizationScopeManager.java:167)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.initialize(SynchronizationScopeManager.java:165)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.access$0(SubscriberScopeManager.java:1)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager$1.run(SubscriberScopeManager.java:81)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.initialize(SubscriberScopeManager.java:79)
	at org.eclipse.team.ui.synchronize.ModelOperation.initializeScope(ModelOperation.java:161)
	at org.eclipse.team.ui.synchronize.ModelOperation.beginOperation(ModelOperation.java:124)
	at org.eclipse.team.ui.synchronize.ModelOperation.run(ModelOperation.java:105)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.collectRelatedChanges(GitScopeUtil.java:168)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.access$0(GitScopeUtil.java:158)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil$1.run(GitScopeUtil.java:141)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 4 Laurent Goubet CLA 2011-09-29 05:42:28 EDT
The same exception is thrown with the latest code from the eclipse egit repository (master branch).
Comment 5 Benjamin Muskalla CLA 2011-10-01 06:14:25 EDT
This is a regression introduced by another change not related to logical models and affects many other egit operations (see task 358621). A fix is currenlty in review.
Comment 6 Benjamin Muskalla CLA 2011-10-10 06:03:36 EDT
Laurent, can you give this another try with todays EGit master? The NPE was resolved in the meantime
Comment 7 Laurent Goubet CLA 2012-02-15 03:07:13 EST
Benjamin,

Sorry for the time it took for me to react, I have been kept quite busy with another project. I could test extensively the different actions that should be calling the model providers, and only found two in EGit that were still comparing without this support. I'll raise the corresponding bugs momentarily.

This particular bug has been fixed and can be closed, thanks!
Comment 8 Laurent Goubet CLA 2012-03-01 08:33:41 EST
For the record, there are two actions still not considering the model providers :

 - Replace With > Local History...
 - Replace With > Previous From Local History.

However, these are "team" actions, that should be fixed through bug 354931.
Comment 9 Benjamin Muskalla CLA 2012-03-02 11:20:41 EST
Great. Let's close this.