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
2
+ 3
2
@@ -588,8 +588,10 @@ def merge_entities(entity_a: Entity,
raise NotImplementedError()
for attribute in ("datatype", "unit", "value"):
# attribute is in r2
if (attribute in diff_r2["properties"][key] and
diff_r2["properties"][key][attribute] is not None):
# but not in r1
if (attribute not in diff_r1["properties"][key] or
diff_r1["properties"][key][attribute] is None):
setattr(entity_a.get_property(key), attribute,
@@ -597,6 +599,7 @@ def merge_entities(entity_a: Entity,
elif force:
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
# attribute in r1 but no "force"
else:
raise_error = True
if merge_id_with_resolved_entity is True and attribute == "value":
@@ -616,8 +619,6 @@ def merge_entities(entity_a: Entity,
else:
same = _same_id_as_resolved_entity(this, that)
if same is True:
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
raise_error = False
if raise_error is True:
raise EntityMergeConflictError(
Loading