Family tree under version control, diff, etc

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Family tree under version control, diff, etc

Sebastian Schubert
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

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users
Reply | Threaded
Open this post in threaded view
|

Re: Family tree under version control, diff, etc

DS Blank
Sebastian,

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?

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.

Hope that helps,

-Doug

On Thu, Nov 14, 2013 at 3:37 PM, Sebastian Schubert
<[hidden email]> 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
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Gramps-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-users

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users
Reply | Threaded
Open this post in threaded view
|

Re: Family tree under version control, diff, etc

Sebastian Schubert
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
> <[hidden email]> 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


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users
Reply | Threaded
Open this post in threaded view
|

Re: Family tree under version control, diff, etc

jerome

 > 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.

As far I remember, only header (time of creation and Gramps version)
are really modified. Changes on media objects and timestamp values are
rather related to BSDDB on import process. 

If you do not want these changes, then maybe to create archives?
http://www.gramps-project.org/wiki/index.php?title=Gramps_3.4_Wiki_Manual_-_Manage_Family_Trees#Archiving_a_Family_Tree

Note, for handling backup files, you can also try to load a Gramps XML
file in memory. If you have a view with more than 10 000 entries, then
maybe you need to use an other lib than provided with the default set
of python modules, but to compare structures or data images is
possible. 

As said, for a nicer and optimized way, Gramps 4.x provides a better
method.


Jérôme


Le jeu. 14 nov. 2013 at 23:25,Sebastian Schubert
<[hidden email]> a écrit :

> 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
>
> _______________________________________________
> Gramps-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-users
>


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users