From: Sebastian S. <sch...@gm...> - 2013-11-14 22:26:08
|
Hi Doug, thanks for your fast reply! Am 14.11.2013 21:55, schrieb Doug Blank: > Presumably, your data is kept in a Gramps database? If so, then you > only need export to gramps format, and compare the XML. Why the import > and delete? I want to have the gramps database mirror the git repository that includes the XML file. Thus, if I went back to an older revision in the git repository, I would like the gramps database to reflect that. Importing the XML file into the database seemed to really add the data sets of the XML file and, therefore, does not what I want. Thus, only deleting and newly creating the database works as far as I can see. > But there is a better way, in any event. There is a "Database > Differences Report" can can tell you exactly what has changed between > files. When you run the report, you compare a .gramps file to the > current database. You could script this. I believe that Gramps 4.0 is > the first version to use report. (It would also be trivial to compare > two .gramps files, BTW). > > In Gramps 4.1, the idea is to even be able to sync data between databases. Thanks, I will look into that once I changed to version 4. Sebastian > Hope that helps, > > -Doug > > On Thu, Nov 14, 2013 at 3:37 PM, Sebastian Schubert > <sch...@gm...> wrote: >> Hi, >> >> I wanted to use git as a version control tool for my family tree to do >> eg quick diffs to see what I recently changed. Since the native format >> of gramps is a binary database I wrote a script to read a gramps-XML >> file with gramps and export a gramps-XML afterwards. To have that >> working, I always delete the complete grampsdb folder to not create more >> and more family trees; I did not find a way to remove one family tree >> from the terminal. I work only with one tree so this is not a problem >> for me but in general this is DANGEROUS! Anyway, do you see a way to >> circumvent this? >> >> So here is the little script >> >> ##################################################################### >> FTREE="MYTREE" >> REPO="/path/to/repo/" >> GRAMPSDB="/home/XYZ/.gramps/grampsdb/" >> >> # open family tree for editing >> gramps "${REPO}/${FTREE}.gramps" >> >> # export edited family tree and extract it >> TMPFILE=`mktemp -u` # remove -u when gramps can overwrite files >> gramps -e "${TMPFILE}" -f gramps -O "${FTREE}" >> gunzip < "${TMPFILE}" > "${REPO}/${FTREE}.gramps" >> rm "${TMPFILE}" >> >> # remove binary gramps database files >> rm -r "${GRAMPSDB}" # ALL FAMILY TREES REMOVED!! >> ##################################################################### >> >> The couple of additional seconds for importing is not an issue for me. >> Tried with gramps 3.4.2. >> >> Any further comments? >> >> Do you think that it is helpful to add this to the wiki? >> http://www.gramps-project.org/wiki/index.php?title=Gramps_XML >> says something about version control but does not tell how to manage that... >> >> Sebastian |