Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way compare
[Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way compare [message #117536] |
Wed, 09 April 2008 20:40 |
Matt Seashore Messages: 58 Registered: July 2009 |
Member |
|
|
I'm doing a 3 way headless comparison (match+diff). In my test, the
ancestor has no children, the "left" model has a new child and the
"right" model has a new (also different) child. These two new children
show up through the match as "UnMatchedElements" which I believe is
correct.
However, when I run the Diff, the unmatched element on the "left" shows
up as a "RemoteRemoveModelElement" instead of a "RemoteAddModelElement"
whereas the "right" element shows up correctly as a "AddModelElement".
This seems like a bug, though I may be missing something.
I've put the serialization of the match and the diff below. Please let
me know if there's more information that would help or if there's
something like a 'snippet' I can modify to show the problem. I am
running against HEAD from CVS for emf compare and Eclipse 3.4 M6.
Thanks,
Matt
Match Model:
<?xml version="1.0" encoding="Cp1252"?>
<match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:match="http://www.eclipse.org/emf/compare/match/1.1"
leftModel="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
rightModel="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6"
originModel="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8">
<matchedElements xsi:type="match:Match3Element"
similarity="0.8777120315581853">
<leftElement
href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
<rightElement
href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
<originElement
href="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8#/"/>
</matchedElements>
<unMatchedElements xsi:type="match:RemoteUnMatchElement">
<element
href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
</unMatchedElements>
<unMatchedElements>
<element
href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
</unMatchedElements>
</match:MatchModel>
Diff Model:
<?xml version="1.0" encoding="Cp1252"?>
<diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1"
left="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
origin="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8"
right="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6">
<ownedElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:AddModelElement">
<leftParent
href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
<rightElement
href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
</subDiffElements>
<subDiffElements xsi:type="diff:RemoteRemoveModelElement">
<leftParent
href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
<rightElement
href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
</subDiffElements>
<leftParent
href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
</subDiffElements>
</ownedElements>
</diff:DiffModel>
Code snippet that runs the match/diff:
HashMap<String, Object> options = new HashMap<String, Object>();
GenericMatchEngine genericMatch = new GenericMatchEngine();
MatchModel match = genericMatch.resourceMatch(modelLeft.eResource(),
modelRight.eResource(), modelAncestor.eResource(),
options);
GenericDiffEngine diffEngine = new GenericDiffEngine();
final DiffModel diff = diffEngine.doDiff(match, true);
|
|
|
Re: [Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way com [message #117554 is a reply to message #117536] |
Wed, 09 April 2008 21:34 |
Matt Seashore Messages: 58 Registered: July 2009 |
Member |
|
|
While debugging through the code I found what may be the issue, it seems
in the GenericDiffEngine 'leftModel' is being left null instead of being
set to the "left" resource.
See: GenericDiffEngine->doDiffThreeWay (line 536).
At least for my case, changing lines 535 (changed 'toString' to 'path')
and 536 (added a 'getElement' call) seemed to fix the issue. The patch
is below.
If someone else can confirm this is a bug, I can follow up and file a
bugzilla.
Thanks,
Matt
### Eclipse Workspace Patch 1.0
#P org.eclipse.emf.compare.diff
Index: src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
============================================================ =======
RCS file:
/cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.compare/pl ugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compa re/diff/engine/GenericDiffEngine.java,v
retrieving revision 1.9
diff -u -r1.9 GenericDiffEngine.java
--- src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va 3 Apr
2008 12:07:44 -0000 1.9
+++ src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va 9 Apr
2008 21:18:39 -0000
@@ -532,8 +532,8 @@
// seeks left resource
Resource leftModel = null;
for (UnMatchElement element : unMatchedElements.keySet()) {
- if
(element.getElement().eResource().getURI().toString().equals (match.getLeftModel()))
{
- leftModel = element.eResource();
+ if
(element.getElement().eResource().getURI().path().equals(mat ch.getLeftModel()))
{
+ leftModel = element.getElement().eResource();
break;
}
}
Matt Seashore wrote:
> I'm doing a 3 way headless comparison (match+diff). In my test, the
> ancestor has no children, the "left" model has a new child and the
> "right" model has a new (also different) child. These two new children
> show up through the match as "UnMatchedElements" which I believe is
> correct.
>
> However, when I run the Diff, the unmatched element on the "left" shows
> up as a "RemoteRemoveModelElement" instead of a "RemoteAddModelElement"
> whereas the "right" element shows up correctly as a "AddModelElement".
> This seems like a bug, though I may be missing something.
>
> I've put the serialization of the match and the diff below. Please let
> me know if there's more information that would help or if there's
> something like a 'snippet' I can modify to show the problem. I am
> running against HEAD from CVS for emf compare and Eclipse 3.4 M6.
>
> Thanks,
>
> Matt
>
>
> Match Model:
>
> <?xml version="1.0" encoding="Cp1252"?>
> <match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1"
> leftModel="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
> rightModel="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6"
> originModel="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8">
>
> <matchedElements xsi:type="match:Match3Element"
> similarity="0.8777120315581853">
> <leftElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
> <originElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8#/"/>
> </matchedElements>
> <unMatchedElements xsi:type="match:RemoteUnMatchElement">
> <element
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>
> </unMatchedElements>
> <unMatchedElements>
> <element
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>
> </unMatchedElements>
> </match:MatchModel>
>
> Diff Model:
>
> <?xml version="1.0" encoding="Cp1252"?>
> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1"
> left="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
> origin="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8"
> right="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6">
> <ownedElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:AddModelElement">
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>
> </subDiffElements>
> <subDiffElements xsi:type="diff:RemoteRemoveModelElement">
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>
> </subDiffElements>
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> </subDiffElements>
> </ownedElements>
> </diff:DiffModel>
>
> Code snippet that runs the match/diff:
>
> HashMap<String, Object> options = new HashMap<String, Object>();
> GenericMatchEngine genericMatch = new GenericMatchEngine();
>
> MatchModel match = genericMatch.resourceMatch(modelLeft.eResource(),
> modelRight.eResource(), modelAncestor.eResource(),
> options);
>
> GenericDiffEngine diffEngine = new GenericDiffEngine();
> final DiffModel diff = diffEngine.doDiff(match, true);
|
|
| |
Re: [Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way com [message #117683 is a reply to message #117609] |
Thu, 10 April 2008 16:38 |
Matt Seashore Messages: 58 Registered: July 2009 |
Member |
|
|
Thanks,
I created a bug for this issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=226565
Matt
laurent Goubet wrote:
> Matt,
>
> This indeed seems to be a bug I may have introduced when last
> refactoring the generic engine. I'll apply this patch after testing a
> little further.
>
> Thanks for the feedback.
>
> Laurent Goubet
> Obeo
>
> Matt Seashore a écrit :
>> While debugging through the code I found what may be the issue, it
>> seems in the GenericDiffEngine 'leftModel' is being left null instead
>> of being set to the "left" resource.
>> See: GenericDiffEngine->doDiffThreeWay (line 536).
>>
>> At least for my case, changing lines 535 (changed 'toString' to
>> 'path') and 536 (added a 'getElement' call) seemed to fix the issue.
>> The patch is below.
>>
>> If someone else can confirm this is a bug, I can follow up and file a
>> bugzilla.
>>
>> Thanks,
>>
>> Matt
>>
>> ### Eclipse Workspace Patch 1.0
>> #P org.eclipse.emf.compare.diff
>> Index: src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> ============================================================ =======
>> RCS file:
>> /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.compare/pl ugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compa re/diff/engine/GenericDiffEngine.java,v
>>
>> retrieving revision 1.9
>> diff -u -r1.9 GenericDiffEngine.java
>> --- src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> 3 Apr 2008 12:07:44 -0000 1.9
>> +++ src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> 9 Apr 2008 21:18:39 -0000
>> @@ -532,8 +532,8 @@
>> // seeks left resource
>> Resource leftModel = null;
>> for (UnMatchElement element : unMatchedElements.keySet()) {
>> - if
>> (element.getElement().eResource().getURI().toString().equals (match.getLeftModel()))
>> {
>> - leftModel = element.eResource();
>> + if
>> (element.getElement().eResource().getURI().path().equals(mat ch.getLeftModel()))
>> {
>> + leftModel = element.getElement().eResource();
>> break;
>> }
>> }
>>
>>
>>
>> Matt Seashore wrote:
>>> I'm doing a 3 way headless comparison (match+diff). In my test, the
>>> ancestor has no children, the "left" model has a new child and the
>>> "right" model has a new (also different) child. These two new
>>> children show up through the match as "UnMatchedElements" which I
>>> believe is correct.
>>>
>>> However, when I run the Diff, the unmatched element on the "left"
>>> shows up as a "RemoteRemoveModelElement" instead of a
>>> "RemoteAddModelElement" whereas the "right" element shows up
>>> correctly as a "AddModelElement". This seems like a bug, though I may
>>> be missing something.
>>>
>>> I've put the serialization of the match and the diff below. Please
>>> let me know if there's more information that would help or if there's
>>> something like a 'snippet' I can modify to show the problem. I am
>>> running against HEAD from CVS for emf compare and Eclipse 3.4 M6.
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>
>>> Match Model:
>>>
>>> <?xml version="1.0" encoding="Cp1252"?>
>>> <match:MatchModel xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1"
>>> leftModel="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
>>> rightModel="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6"
>>> originModel="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8">
>>>
>>> <matchedElements xsi:type="match:Match3Element"
>>> similarity="0.8777120315581853">
>>> <leftElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
>>>
>>> <originElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8#/"/>
>>>
>>> </matchedElements>
>>> <unMatchedElements xsi:type="match:RemoteUnMatchElement">
>>> <element
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>>>
>>> </unMatchedElements>
>>> <unMatchedElements>
>>> <element
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>>>
>>> </unMatchedElements>
>>> </match:MatchModel>
>>>
>>> Diff Model:
>>>
>>> <?xml version="1.0" encoding="Cp1252"?>
>>> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1"
>>> left="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
>>> origin="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8"
>>> right="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6">
>>> <ownedElements xsi:type="diff:DiffGroup">
>>> <subDiffElements xsi:type="diff:DiffGroup">
>>> <subDiffElements xsi:type="diff:AddModelElement">
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>>>
>>> </subDiffElements>
>>> <subDiffElements xsi:type="diff:RemoteRemoveModelElement">
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>>>
>>> </subDiffElements>
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> </subDiffElements>
>>> </ownedElements>
>>> </diff:DiffModel>
>>>
>>> Code snippet that runs the match/diff:
>>>
>>> HashMap<String, Object> options = new HashMap<String, Object>();
>>> GenericMatchEngine genericMatch = new GenericMatchEngine();
>>>
>>> MatchModel match = genericMatch.resourceMatch(modelLeft.eResource(),
>>> modelRight.eResource(), modelAncestor.eResource(),
>>> options);
>>>
>>> GenericDiffEngine diffEngine = new GenericDiffEngine();
>>> final DiffModel diff = diffEngine.doDiff(match, true);
>
|
|
|
Re: [Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way com [message #616167 is a reply to message #117536] |
Wed, 09 April 2008 21:34 |
Matt Seashore Messages: 58 Registered: July 2009 |
Member |
|
|
While debugging through the code I found what may be the issue, it seems
in the GenericDiffEngine 'leftModel' is being left null instead of being
set to the "left" resource.
See: GenericDiffEngine->doDiffThreeWay (line 536).
At least for my case, changing lines 535 (changed 'toString' to 'path')
and 536 (added a 'getElement' call) seemed to fix the issue. The patch
is below.
If someone else can confirm this is a bug, I can follow up and file a
bugzilla.
Thanks,
Matt
### Eclipse Workspace Patch 1.0
#P org.eclipse.emf.compare.diff
Index: src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
============================================================ =======
RCS file:
/cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.compare/pl ugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compa re/diff/engine/GenericDiffEngine.java,v
retrieving revision 1.9
diff -u -r1.9 GenericDiffEngine.java
--- src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va 3 Apr
2008 12:07:44 -0000 1.9
+++ src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va 9 Apr
2008 21:18:39 -0000
@@ -532,8 +532,8 @@
// seeks left resource
Resource leftModel = null;
for (UnMatchElement element : unMatchedElements.keySet()) {
- if
(element.getElement().eResource().getURI().toString().equals (match.getLeftModel()))
{
- leftModel = element.eResource();
+ if
(element.getElement().eResource().getURI().path().equals(mat ch.getLeftModel()))
{
+ leftModel = element.getElement().eResource();
break;
}
}
Matt Seashore wrote:
> I'm doing a 3 way headless comparison (match+diff). In my test, the
> ancestor has no children, the "left" model has a new child and the
> "right" model has a new (also different) child. These two new children
> show up through the match as "UnMatchedElements" which I believe is
> correct.
>
> However, when I run the Diff, the unmatched element on the "left" shows
> up as a "RemoteRemoveModelElement" instead of a "RemoteAddModelElement"
> whereas the "right" element shows up correctly as a "AddModelElement".
> This seems like a bug, though I may be missing something.
>
> I've put the serialization of the match and the diff below. Please let
> me know if there's more information that would help or if there's
> something like a 'snippet' I can modify to show the problem. I am
> running against HEAD from CVS for emf compare and Eclipse 3.4 M6.
>
> Thanks,
>
> Matt
>
>
> Match Model:
>
> <?xml version="1.0" encoding="Cp1252"?>
> <match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1"
> leftModel="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
> rightModel="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6"
> originModel="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8">
>
> <matchedElements xsi:type="match:Match3Element"
> similarity="0.8777120315581853">
> <leftElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
> <originElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8#/"/>
> </matchedElements>
> <unMatchedElements xsi:type="match:RemoteUnMatchElement">
> <element
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>
> </unMatchedElements>
> <unMatchedElements>
> <element
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>
> </unMatchedElements>
> </match:MatchModel>
>
> Diff Model:
>
> <?xml version="1.0" encoding="Cp1252"?>
> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1"
> left="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
> origin="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8"
> right="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6">
> <ownedElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:AddModelElement">
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>
> </subDiffElements>
> <subDiffElements xsi:type="diff:RemoteRemoveModelElement">
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
> <rightElement
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>
> </subDiffElements>
> <leftParent
> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
> </subDiffElements>
> </ownedElements>
> </diff:DiffModel>
>
> Code snippet that runs the match/diff:
>
> HashMap<String, Object> options = new HashMap<String, Object>();
> GenericMatchEngine genericMatch = new GenericMatchEngine();
>
> MatchModel match = genericMatch.resourceMatch(modelLeft.eResource(),
> modelRight.eResource(), modelAncestor.eResource(),
> options);
>
> GenericDiffEngine diffEngine = new GenericDiffEngine();
> final DiffModel diff = diffEngine.doDiff(match, true);
|
|
| |
Re: [Compare] Problem with getting RemoteRemoveModelElement vs. RemoteAddModelElement with 3 way com [message #616186 is a reply to message #117609] |
Thu, 10 April 2008 16:38 |
Matt Seashore Messages: 58 Registered: July 2009 |
Member |
|
|
Thanks,
I created a bug for this issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=226565
Matt
laurent Goubet wrote:
> Matt,
>
> This indeed seems to be a bug I may have introduced when last
> refactoring the generic engine. I'll apply this patch after testing a
> little further.
>
> Thanks for the feedback.
>
> Laurent Goubet
> Obeo
>
> Matt Seashore a écrit :
>> While debugging through the code I found what may be the issue, it
>> seems in the GenericDiffEngine 'leftModel' is being left null instead
>> of being set to the "left" resource.
>> See: GenericDiffEngine->doDiffThreeWay (line 536).
>>
>> At least for my case, changing lines 535 (changed 'toString' to
>> 'path') and 536 (added a 'getElement' call) seemed to fix the issue.
>> The patch is below.
>>
>> If someone else can confirm this is a bug, I can follow up and file a
>> bugzilla.
>>
>> Thanks,
>>
>> Matt
>>
>> ### Eclipse Workspace Patch 1.0
>> #P org.eclipse.emf.compare.diff
>> Index: src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> ============================================================ =======
>> RCS file:
>> /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.compare/pl ugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compa re/diff/engine/GenericDiffEngine.java,v
>>
>> retrieving revision 1.9
>> diff -u -r1.9 GenericDiffEngine.java
>> --- src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> 3 Apr 2008 12:07:44 -0000 1.9
>> +++ src/org/eclipse/emf/compare/diff/engine/GenericDiffEngine.ja va
>> 9 Apr 2008 21:18:39 -0000
>> @@ -532,8 +532,8 @@
>> // seeks left resource
>> Resource leftModel = null;
>> for (UnMatchElement element : unMatchedElements.keySet()) {
>> - if
>> (element.getElement().eResource().getURI().toString().equals (match.getLeftModel()))
>> {
>> - leftModel = element.eResource();
>> + if
>> (element.getElement().eResource().getURI().path().equals(mat ch.getLeftModel()))
>> {
>> + leftModel = element.getElement().eResource();
>> break;
>> }
>> }
>>
>>
>>
>> Matt Seashore wrote:
>>> I'm doing a 3 way headless comparison (match+diff). In my test, the
>>> ancestor has no children, the "left" model has a new child and the
>>> "right" model has a new (also different) child. These two new
>>> children show up through the match as "UnMatchedElements" which I
>>> believe is correct.
>>>
>>> However, when I run the Diff, the unmatched element on the "left"
>>> shows up as a "RemoteRemoveModelElement" instead of a
>>> "RemoteAddModelElement" whereas the "right" element shows up
>>> correctly as a "AddModelElement". This seems like a bug, though I may
>>> be missing something.
>>>
>>> I've put the serialization of the match and the diff below. Please
>>> let me know if there's more information that would help or if there's
>>> something like a 'snippet' I can modify to show the problem. I am
>>> running against HEAD from CVS for emf compare and Eclipse 3.4 M6.
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>
>>> Match Model:
>>>
>>> <?xml version="1.0" encoding="Cp1252"?>
>>> <match:MatchModel xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1"
>>> leftModel="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
>>> rightModel="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6"
>>> originModel="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8">
>>>
>>> <matchedElements xsi:type="match:Match3Element"
>>> similarity="0.8777120315581853">
>>> <leftElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
>>>
>>> <originElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8#/"/>
>>>
>>> </matchedElements>
>>> <unMatchedElements xsi:type="match:RemoteUnMatchElement">
>>> <element
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>>>
>>> </unMatchedElements>
>>> <unMatchedElements>
>>> <element
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>>>
>>> </unMatchedElements>
>>> </match:MatchModel>
>>>
>>> Diff Model:
>>>
>>> <?xml version="1.0" encoding="Cp1252"?>
>>> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1"
>>> left="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217"
>>> origin="/objects/org.example.model.impl.AllObjectsContainedImpl@65dbe8"
>>> right="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6">
>>> <ownedElements xsi:type="diff:DiffGroup">
>>> <subDiffElements xsi:type="diff:DiffGroup">
>>> <subDiffElements xsi:type="diff:AddModelElement">
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#LocalAdd"/>
>>>
>>> </subDiffElements>
>>> <subDiffElements xsi:type="diff:RemoteRemoveModelElement">
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@13a46b6#/"/>
>>>
>>> <rightElement
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#RemoteAdd"/>
>>>
>>> </subDiffElements>
>>> <leftParent
>>> href="/objects/org.example.model.impl.AllObjectsContainedImpl@1487217#/"/>
>>>
>>> </subDiffElements>
>>> </ownedElements>
>>> </diff:DiffModel>
>>>
>>> Code snippet that runs the match/diff:
>>>
>>> HashMap<String, Object> options = new HashMap<String, Object>();
>>> GenericMatchEngine genericMatch = new GenericMatchEngine();
>>>
>>> MatchModel match = genericMatch.resourceMatch(modelLeft.eResource(),
>>> modelRight.eResource(), modelAncestor.eResource(),
>>> options);
>>>
>>> GenericDiffEngine diffEngine = new GenericDiffEngine();
>>> final DiffModel diff = diffEngine.doDiff(match, true);
>
|
|
|
Goto Forum:
Current Time: Fri Apr 19 11:45:49 GMT 2024
Powered by FUDForum. Page generated in 0.03554 seconds
|