Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:12 Go to next message
Mojtaba Bagherzadeh is currently offline Mojtaba BagherzadehFriend
Messages: 30
Registered: April 2016
Member
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 07:54 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1843
Registered: July 2009
Senior Member
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 14:47 Go to previous message
Mojtaba Bagherzadeh is currently offline Mojtaba BagherzadehFriend
Messages: 30
Registered: April 2016
Member
Thanks a lot, I will try that.
Previous Topic:EMF Compare Performance
Next Topic:EMF Compare EGIT Performance
Goto Forum:
  


Current Time: Fri Jan 19 01:50:18 GMT 2018

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

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