I am working on an application that stores EMF models remotely in a Git repository for the purpose of collaborative modeling. My application requires the ability to pull remote model changes, and I would like to use EMF Compare for detecting conflicts.
My first attempt at conflict detection using JGit's ResolveMerger class failed (quite predictably, since JGit is not model-aware).
ResolveMerger merger = (ResolveMerger) new StrategyRecursiveModel().newMerger(repo, true);
However, I still get unexpected conflicts. I suspect I may not be instantiating the EMF Compare merger properly, or that it may need some customization for my particular models (i.e. somehow extending the DefaultMatchEngine).
Are there any examples or guides for how to properly invoke the EMF Compare match engine programmatically in a scenario such as the one I described? So far I consulted the EMF Compare developer guide. The code snippets I found there are very useful, but it appears they are somewhat incomplete as a how-to guide.
Using the JGit mergers directly involves quite a bit or work and setting up. Make sure you look at the other places where they are used in the JGit and EGit code bases to see how they are initialized and invoked. You need to make sure the comparison engine actually has access to all the data it needs to compare your revisions.
As for your conflicts, I'd suggest you try directly from eclipse instead of using your custom code to invoke EMF Compare through git actions such as Team > Compare With > Revision and see if you get the result you're expecting or not. If not, then yes, you will have to customize the match and diff engines to properly detect the kind of conflicts (or lack of conflicts) you envision. I'd suggest taking a look at what you can do through post-processing of the differences model since that is usually enough. The developer guide explains how to provide your custom post-processor through extension points so that they are "seen" at runtime by EMF Compare when it is invoked for a comparison.