Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » How handle only merge the right difference into left?
How handle only merge the right difference into left? [message #1771674] Tue, 29 August 2017 13:20 Go to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
To whom it may concern,

I am the freshman of EMF merge. I want have a simple way to merge two file into one: only merge the right part difference into left.

As the figure:

index.php/fa/30522/0/

But when I follow the sample: TwoWayatchMerge, the result will change the Man AAA with Man BBB in left.family.

index.php/fa/30523/0/

        final IComparisonScope scope = new DefaultComparisonScope(leftResourceSet, rightResourceSet, null);
        Comparison comparison = EMFCompare.builder().build().compare(scope);
        final EList<Diff> differences = comparison.getDifferences();
        IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
        final IBatchMerger merger = new BatchMerger(mergerRegistry);
        merger.copyAllRightToLeft(differences, new BasicMonitor());



Please give me some help. Thanks.

[Updated on: Tue, 29 August 2017 13:25]

Report message to a moderator

Re: How handle only merge the right difference into left? [message #1771823 is a reply to message #1771674] Thu, 31 August 2017 05:32 Go to previous messageGo to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
Is there anyone who can help me?
Re: How handle only merge the right difference into left? [message #1771841 is a reply to message #1771823] Thu, 31 August 2017 09:06 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Nicholas,

In this example, EMF Compare is matching left's AAA with right's BBB, in other words we only see one "Man", not two. Thus, the difference we see in there is that "the man's name changed from AAA to BBB", not "man BBB has been added". Merging this difference will then change the man's name instead of adding another one.

This is due to there being too little differences to say that the two men are "different". You will have to either make more differences between the two models so that emf compare can properly differenciate the two "man" instances, start to use IDs to differentiate your items, or customize the matching so that EMF Compare uses the "name" of your objects as an identifier instead of just another attribute. More on this last point in the documentation.

Laurent Goubet
Obeo
Previous Topic:Undo a Merge
Next Topic:NPE when comparing with HEAD (EGit)
Goto Forum:
  


Current Time: Wed Apr 24 17:02:49 GMT 2024

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

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

Back to the top