From ca5953f1bce3e46cde4d4b8f01268aa6f58021a2 Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 6 Dec 2016 09:06:03 -0600 Subject: [PATCH] bug 9818 allow merging of families with one or more parents in common --- gramps/gen/merge/mergefamilyquery.py | 32 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/gramps/gen/merge/mergefamilyquery.py b/gramps/gen/merge/mergefamilyquery.py index c2e14d90b..43b18ca9a 100644 --- a/gramps/gen/merge/mergefamilyquery.py +++ b/gramps/gen/merge/mergefamilyquery.py @@ -134,15 +134,35 @@ class MergeFamilyQuery(object): with DbTxn(_('Merge Family'), self.database) as trans: - phoenix_father = self.database.get_person_from_handle(self.phoenix_fh) - titanic_father = self.database.get_person_from_handle(self.titanic_fh) - self.merge_person(phoenix_father, titanic_father, 'father', trans) + if self.phoenix_fh != self.titanic_fh: + if self.phoenix_fh: + phoenix_father = self.database.get_person_from_handle( + self.phoenix_fh) + else: + phoenix_father = None + if self.titanic_fh: + titanic_father = self.database.get_person_from_handle( + self.titanic_fh) + else: + titanic_father = None + self.merge_person(phoenix_father, titanic_father, + 'father', trans) - phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh) - titanic_mother = self.database.get_person_from_handle(self.titanic_mh) + if self.phoenix_mh != self.titanic_mh: + if self.phoenix_mh: + phoenix_mother = self.database.get_person_from_handle( + self.phoenix_mh) + else: + phoenix_mother = None + if self.titanic_mh: + titanic_mother = self.database.get_person_from_handle( + self.titanic_mh) + else: + titanic_mother = None + self.merge_person(phoenix_mother, titanic_mother, + 'mother', trans) self.phoenix = self.database.get_family_from_handle(new_handle) self.titanic = self.database.get_family_from_handle(old_handle) - self.merge_person(phoenix_mother, titanic_mother, 'mother', trans) phoenix_father = self.database.get_person_from_handle(self.phoenix_fh) phoenix_mother = self.database.get_person_from_handle(self.phoenix_mh)