elliotchance / gedcom

👪 A Go library and CLI tools for encoding, decoding, traversing, merging, comparing, querying and publishing GEDCOM files.
MIT License
93 stars 20 forks source link

How to merge two ged files #312

Open emilepetrone opened 4 years ago

emilepetrone commented 4 years ago

I am running Mac release v39.5.1 and am trying to merge two ged files. I do not know GO so maybe I am just missing something very basic.

In following the documentation, I see the CLI commands but do not see how to merge two files.

$ ./gedcom
2020/06/07 10:44:26 ERROR: Missing command, use one of:
    ./gedcom diff      - Compare gedcom files
    ./gedcom publish   - Publish as HTML
    ./gedcom query     - Query with gedcomq
    ./gedcom tune      - Used to calculate ideal weights and similarities
    ./gedcom version   - Show version and exit
    ./gedcom warnings  - Show warnings for a gedcom file

How do I merge two ged files?

elliotchance commented 4 years ago

Hi @emilepetrone - I've been meaning to create a separate command for it but haven't got around to it. You can use query:

./gedcom query -gedcom file1.ged -gedcom file2.ged -format gedcom 'MergeDocumentsAndIndividuals(Document1, Document2)' > merged.ged

Let me know if this works for you.

emilepetrone commented 4 years ago

Thank you for the reply, @elliotchance it ran without error. What would be the best way to validate the merger? I can see the file size is roughly 2x each of the individual files.

When I upload the new GED file to Ancestry.com, it gave me an error to reupload. I inspected the file and noticed it was missing some header information that I added (pure guessing that was the issue. The error didn't give me any information to go on). When I uploaded the merged GED file again, it succeeded but started the tree at a weird point. I'm not sure if that is due to the merger or Ancestry.com playing some games

What do you think is the best way to validate the new file? Thanks again!

elliotchance commented 4 years ago

The output should be valid GEDCOM, if not that is a bug. It's helpful that you mention the header information may be mangled because in the case of a merge it creates a new GEDCOM file with the result, rather than modifying one with the other, so some information may be lost.

Can put the missing header information here?

As for the tree itself, it's possible that is also a bug. I would need more information about what it did vs what you expected from it?

emilepetrone commented 4 years ago

To make sure it wasn't an intermittent bug with Ancestry, I just merged the 2 GED files again.

0 HEAD
1 CHAR UTF-8
1 SOUR Ancestry.com Family Trees
2 VERS (2010.3)
2 NAME Ancestry.com Family Trees
2 CORP Ancestry.com
1 GEDC
2 VERS 5.5

The 2 GED files I am trying to merge are trees I created in Ancestry, exported, and am now trying to merge. One tree is my Mom's family. The other is my Father's family. I am the common person at the bottom of both.

When I merge them, I was expecting them to see I am the common person at the top of each file. However, it doesn't appear to do that. It finds that one of my ancestors is the common person and starts there.

In looking more closely at the files, I have 2 different values for 0 @P455@ INDI and the ancestor it starts with has a matching INDI value in both files. I am guessing that is ultimately the issue. Without the INDI values matching, it can't match on me and that is causing the confusion.