Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » How to integrate emf compare with eclipse team support?
How to integrate emf compare with eclipse team support? [message #996498] Wed, 02 January 2013 08:21 Go to next message
wakandan wakandan is currently offline wakandan wakandanFriend
Messages: 6
Registered: January 2013
Junior Member
Adding team plugin in your eclipse plugin project will enable team, compare with and so on options in your project explorer. What I want to do is, when I right click on my persisted model file (xmi file format), choose "compare with latest from repository", the emf compare editor should show me the changes between my local version and one stored on svn server. However, the emf compare editor shows "no differences" while default text compare shows them correctly.

I would like to ask whether adding this kind of native version control support through eclipse team to xmi file is possible at the moment and if yes, how to do it?
Re: How to integrate emf compare with eclipse team support? [message #996940 is a reply to message #996498] Thu, 03 January 2013 08:53 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
I had started answering this on stackoverflow. See the question there for details, but here is a small abstract of the discussion we started over there :

Wakandan

How can we tell EMF Compare to trigger when comparing files with a given extension? The content-type org.eclipse.emf.compare.ui.contenttype.ModelContentType no longer exists with EMF Compare 2.

I tried adding a file-type association between my custom file extension and the org.eclipse.emf.ecore.xmi content-type so that emf compare could pick up my file and do the diff automatically. This way, the emf model compare editor shows up but it says there's no differences even though I pretty sure I made some changes to the model. What should I do?


Laurent Goubet

EMF Compare is called from the platform if the content-type matches, whether you're using compare with > each other or compare with > latest from repository... or any other does not matter.

With EMF Compare 2, we have yet to re-add a custom content-type, but you can achieve the same result with the org.eclipse.emf.ecore.xmi extension, which you have done.

compare with > latest from repository not showing any difference means that we have failed to retrieve the proper "remote" content for your file. you can switch back to text comparison (from the model compare editor) with the drop-down menu at the center that shows "EMF Compare" : just select "text compare" in there. There, you should see the textual differences between your files : if there are none, then we indeed failed to retrieve the proper remote content (or you actually have no difference between the local and remote files).

If that is the case, do you have anything that shows up in your error log (Window > Show View > Error Log)? What repository are you using, CVS? Is your comparison actually showing textual differences between your files when you disable EMF Compare altogether?


Wakandan

While emf compare editor shows no difference, the textual compare editor did show changes between local v.s remote file. In this case, what should I do? Debugging into the action "compare with latest from repo" shows me that the diff was done on the server side, and the input into emf compare editor was a list of svndiff thingy

[Updated on: Thu, 03 January 2013 08:54]

Report message to a moderator

Re: How to integrate emf compare with eclipse team support? [message #996945 is a reply to message #996940] Thu, 03 January 2013 09:02 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
What I did not see when I previously answered is that you are using SVN. This is a repository provider we haven't tried in depth... I hope that this is not what's causing the issue.

Quote:
the textual compare editor did show changes between local v.s remote file


The EMF Compare editor checks for differences on a semantic level. It is entirely possible to have no differences in EMF Compare with files that are different if those differences amount to no change at the semantic level. For example if the changes are in whitespaces or in the xmi format while not changing any attribute or reference value. Is this the kind of differences you see in the textual comparison?

Quote:
the input into emf compare editor was a list of svndiff thingy


This is normal, what might not be is how we interpret those. We try and load the models in EMFSynchronizationModel#createSynchronizationModel(). If there is an issue in our interpreting of the SVN information, it will be there. Can you debug EMFSynchronizationModel#createMinimizedScope() and check whether it manages to load the three resource sets corresponding to your models? My guess is that it does not, in which case you will need to open a bug against EMF Compare as we probably can't handle the SVN revision information.

Laurent Goubet
Obeo
Re: How to integrate emf compare with eclipse team support? [message #996948 is a reply to message #996945] Thu, 03 January 2013 09:09 Go to previous messageGo to next message
wakandan wakandan is currently offline wakandan wakandanFriend
Messages: 6
Registered: January 2013
Junior Member
Quote:
The EMF Compare editor checks for differences on a semantic level. It is entirely possible to have no differences in EMF Compare with files that are different if those differences amount to no change at the semantic level. For example if the changes are in whitespaces or in the xmi format while not changing any attribute or reference value. Is this the kind of differences you see in the textual comparison?


I pretty sure the changes made affected the model.

Quote:

This is normal, what might not be is how we interpret those. We try and load the models in EMFSynchronizationModel#createSynchronizationModel(). If there is an issue in our interpreting of the SVN information, it will be there. Can you debug EMFSynchronizationModel#createMinimizedScope() and check whether it manages to load the three resource sets corresponding to your models? My guess is that it does not, in which case you will need to open a bug against EMF Compare as we probably can't handle the SVN revision information.


Great pointer there. On my first attempt I couldn't see where emf compare get triggered during the compare process, so not much could be done. Let's me give it a try.
Re: How to integrate emf compare with eclipse team support? [message #996963 is a reply to message #996948] Thu, 03 January 2013 09:49 Go to previous messageGo to next message
wakandan wakandan is currently offline wakandan wakandanFriend
Messages: 6
Registered: January 2013
Junior Member
It turned out that in EMFCompareStructureMergeViewer.compareInputChanged, when it was trying to build a synchronization model using
createSynchronizationModel, file revision of left/right/origin could not be resolved (SVNRevision doesn't implement the same IFileRevision interface, I suspect). That make their revisions null. Because of that, the code couldn't get resource set of any of them. Hence the null-comparision...How shall we fix this?

May I ask why we can't reduce everything into just 1 case of comparing 2 emf models? In the end, whether it's svn, csv or git they are all resources. As long as EMF compare got a pair of resources it should be good to go right?
Re: How to integrate emf compare with eclipse team support? [message #996974 is a reply to message #996963] Thu, 03 January 2013 10:20 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Quote:
file revision of left/right/origin could not be resolved (SVNRevision doesn't implement the same IFileRevision interface, I suspect)


That's what I expected. The IFileRevision is there, somewhere, but we need a specific workaround to find it. One way or another, subversive needs to integrate itself with the Eclipse Team APIs, and it is that API that EMF Compare uses in order to make sense of the repository specific information. That's the goal of EMFSynchronizationModel#findFileRevision(ITypedElement), but obviously the tricks I use for EGit and CVS are not sufficient for subversive (or subclipse, whichever you're using).

Quote:
May I ask why we can't reduce everything into just 1 case of comparing 2 emf models? In the end, whether it's svn, csv or git they are all resources. As long as EMF compare got a pair of resources it should be good to go right?


That is unfortunately not the case. EGit, CVS, Subclipse, Subversive, Clearcase ... none of them implements the Team APIs the same way. The goal of EMFSynchronizationModel _is_ to try and make some sense out of this mess, and precisely reduce the case to just "comparing n revisions". But to this end we still need to find a way to handle the distinct information we are fed by the distinct repository providers.

Note, too, that you are not "comparing 2 models" but in fact comparing 3 models : your local version, the latest version from the SVN repository, and the common ancestor of these two. The presence of the ancestor is what allows comparison algorithms to detect conflicts.

Furthermore, EMF resources are not only "1 file each" : each EMF model can reference others (model fragments, dependencies...), and we need to "find" these others in order to properly compare the resources. That is why we load a full resource set, even if in your case there are no other dependencies, we still need to determine the remote revisions' contents. You might find the description of what is a logical model instructive.

Laurent Goubet
Obeo
Re: How to integrate emf compare with eclipse team support? [message #997150 is a reply to message #996974] Fri, 04 January 2013 01:50 Go to previous messageGo to next message
wakandan wakandan is currently offline wakandan wakandanFriend
Messages: 6
Registered: January 2013
Junior Member
Quote:
That is unfortunately not the case. EGit, CVS, Subclipse, Subversive, Clearcase ... none of them implements the Team APIs the same way. The goal of EMFSynchronizationModel _is_ to try and make some sense out of this mess, and precisely reduce the case to just "comparing n revisions". But to this end we still need to find a way to handle the distinct information we are fed by the distinct repository providers.


Any direction of how to fix that? EMF Compare to me is so great, make working with emf a breeze. I suppose the fix (if any) would be adapters for each of version control systems?
Re: How to integrate emf compare with eclipse team support? [message #997151 is a reply to message #997150] Fri, 04 January 2013 02:06 Go to previous messageGo to next message
wakandan wakandan is currently offline wakandan wakandanFriend
Messages: 6
Registered: January 2013
Junior Member
Btw is it possible if I could update the emf compare documentation with some examples taking from what I'm working on? They may not be very good, but at least it can help someone else next time...
Re: How to integrate emf compare with eclipse team support? [message #997160 is a reply to message #997150] Fri, 04 January 2013 07:55 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Quote:

Any direction of how to fix that? EMF Compare to me is so great, make working with emf a breeze. I suppose the fix (if any) would be adapters for each of version control systems?


As mentionned above, the way to fix this will be to implement the necessary case within EMFSynchronizationModel#findFileRevision(ITypedElement) for it to adapt the SVN revisions to IFileRefevisions. What we currently have works for CVS and EGit, but it will need tweaking for the SVN plugins. One of the main problematic points is that we do not (neither do we want to) depend on those plugins, and so cannot use subversive specific code to adapt the revisions.

We have other priorities at the moment though, so making EMF Compare work with subversive/subclipse will come at a later time (we still have a lot to stabilize from the switch to version 2.*). Please raise a bug on the eclipse bugzilla to track the issue.

Quote:

Btw is it possible if I could update the emf compare documentation with some examples taking from what I'm working on?


The documentation is a wiki, feel free to edit it with your own examples if you think you have samples that could help others (maybe make an examples section with the description of the issues you've faced and how you fixed them?). Take good note that we'll do a good overhaul of the doc ourselves as soon as the current issues we're working on are fixed, so the contents and links between pages will most likely change.

Laurent Goubet
Obeo
Previous Topic:How contribute action to compare with menu
Next Topic:EMF Compare models containing "Non-Model Intermediary View Objects"
Goto Forum:
  


Current Time: Wed Nov 26 01:54:28 GMT 2014

Powered by FUDForum. Page generated in 0.11960 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software