Skip to main content



      Home
Home » Modeling » Compare » code snippet for loading comparing models from GIT(code snippet for loading comparing models from GIT)
code snippet for loading comparing models from GIT [message #1768366] Tue, 18 July 2017 01:12 Go to next message
Eclipse UserFriend
Hi Everyone,

I am trying to the EMFCompare programmatically to compare a version of a model in the workspace with another version of that in the git. I found some useful information to do it on models from when they are on the local disk as below code, but I do not know how I can do the same thing if the models are located in a git repository?

Thanks
Mojtaba

URI uri1 = URI.createFileURI("/Users/workspace-papyrus-rt_user/cs.queensu.ca.emfcompare/src/cs/queensu/ca/emfcompare/actions/left.uml");
URI uri2 = URI.createFileURI("/Users/workspace-papyrus-rt_user/cs.queensu.ca.emfcompare/src/cs/queensu/ca/emfcompare/actions/right.uml");

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("uml", UMLResource.Factory.INSTANCE);
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();

resourceSet1.getResource(uri1, true);
resourceSet2.getResource(uri2, true);

IComparisonScope scope = new DefaultComparisonScope(resourceSet1, resourceSet2, null);
Comparison comparison = EMFCompare.builder().build().compare(scope);

List<Diff> differences = comparison.getDifferences();
System.out.println(differences);
Re: code snippet for loading comparing models from GIT [message #1768379 is a reply to message #1768366] Tue, 18 July 2017 03:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Programmatic access to the Git history is not as easily done, you will have to look around at the EGit documentation for that since EMF Compare doesn't do that directly. You might want to take a look at the "Compare With" action implementations from the EGit side since they're what's browsing the history and selecting revisions. An example of that would be org.eclipse.egit.ui.internal.actions.CompareWithHeadAction.

Laurent Goubet
Obeo
Re: code snippet for loading comparing models from GIT [message #1768882 is a reply to message #1768379] Mon, 24 July 2017 10:47 Go to previous message
Eclipse UserFriend
Thanks a lot, I will try that.
Previous Topic:EMF Compare Performance
Next Topic:EMF Compare EGIT Performance
Goto Forum:
  


Current Time: Thu Jul 17 02:39:21 EDT 2025

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

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

Back to the top