Skip to content
Snippets Groups Projects

Draft: FIX: do not replace prop during merge

Open Henrik tom Wörden requested to merge f-compare into dev

Files

+ 3
2
@@ -587,8 +587,10 @@ def merge_entities(entity_a: Entity,
@@ -587,8 +587,10 @@ def merge_entities(entity_a: Entity,
raise NotImplementedError()
raise NotImplementedError()
for attribute in ("datatype", "unit", "value"):
for attribute in ("datatype", "unit", "value"):
 
# attribute is in r2
if (attribute in diff_r2["properties"][key] and
if (attribute in diff_r2["properties"][key] and
diff_r2["properties"][key][attribute] is not None):
diff_r2["properties"][key][attribute] is not None):
 
# but not in r1
if (attribute not in diff_r1["properties"][key] or
if (attribute not in diff_r1["properties"][key] or
diff_r1["properties"][key][attribute] is None):
diff_r1["properties"][key][attribute] is None):
setattr(entity_a.get_property(key), attribute,
setattr(entity_a.get_property(key), attribute,
@@ -596,6 +598,7 @@ def merge_entities(entity_a: Entity,
@@ -596,6 +598,7 @@ def merge_entities(entity_a: Entity,
elif force:
elif force:
setattr(entity_a.get_property(key), attribute,
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
diff_r2["properties"][key][attribute])
 
# attribute in r1 but no "force"
else:
else:
raise_error = True
raise_error = True
if merge_id_with_resolved_entity is True and attribute == "value":
if merge_id_with_resolved_entity is True and attribute == "value":
@@ -615,8 +618,6 @@ def merge_entities(entity_a: Entity,
@@ -615,8 +618,6 @@ def merge_entities(entity_a: Entity,
else:
else:
same = _same_id_as_resolved_entity(this, that)
same = _same_id_as_resolved_entity(this, that)
if same is True:
if same is True:
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
raise_error = False
raise_error = False
if raise_error is True:
if raise_error is True:
raise EntityMergeConflictError(
raise EntityMergeConflictError(
Loading