Thursday, April 22, 2010

GNUmed plugin development - how to share your work

In the last article I shared my work by posting a few screenshots and a tarball for everyone to grab. However the ultimate goal is to get this included onto GNUmed's main code repository.

A while back the GNUmed project announced it made the switch from CVS to GIT. That means that it moved from a centralized repository (CVS head) to a distributed repository architecture. In short. There is no longer an 'officical' or 'central' code repository to submit our plugin to.

However not all is lost. The most active coders share their so called GIT trees with the world so that is now the de facto standard. This is not carved into stone but since Karsten Hilbert has been making released based on his GIT tree this tree is the main tree for the time being.

What we need to do is ask him to merge our code into his tree so it will be part of the next releases. Same procedure is implemented for the Linux kernel where Linus Torvalds merges code from other developers and finally releases a new kernel.

There is one problem. I did not consider this when working on the plugin so I need to get my stuff straight and my hands dirty with GIT.

First I get a local copy of the 'main tree'. It is hosted at gitorious for everyone to grab. I grab a copy by cloning it. For that I create a subdirectory 'Sources' in my home directory and run the following command.
git clone git://
Now I have a copy of the main tree which can be kept up to date by running the following commands.
git checkout master
git fetch
This gives us the latest code in the master branch. For our plugin it makes sense to create our own branch. This is done by the following command.
git branch add-echo-xml
To list all available branches use:
git branch
It will output:
*  add-echo-xml                                                                                                                                                             
The branch with the asterisk is the currently active one.  To switch to the master tree (e.g. for updates) use:
git checkout master
To activate and develop in our own branch use this:
git checkout add-echo-xml
It will do some magic and track all change we make to the existing and new files. It will find out that we change existing files, delete files or add files. Now is the time to add our previously created files from the tarball I talked about in the last article. Just copy them into the corresponding directories. We have to tell git about them so it can track the changes to them. This is done by adding the file once and commiting after a change. In the wxGladeWidgets directory we run:
git add
In the wxg direcotory we run:
git add wxgCardiacEchoPnl.wxg
In the wxpython directory we run:
git add
In the wxpython/gui directory we run:
git add
Finally we commit all this by:
git commit
This will ask for a commit message which is a short message to keep track of your changes. Once done it will output:                                                                                                                                                                           
[add-echo-xml f0b2d35] - added new files for echo plugin                                                                                                                   
 4 files changed, 1196 insertions(+), 0 deletions(-)                                                                                                                       
 create mode 100755 gnumed/gnumed/client/wxGladeWidgets/                                                                                         
 create mode 100644 gnumed/gnumed/client/wxg/wxgCardiacEchoPnl.wxg
 create mode 100644 gnumed/gnumed/client/wxpython/
 create mode 100644 gnumed/gnumed/client/wxpython/gui/
Whenever we change files during developement we need to go through this (git branch add-echo-xml, git add, git commit) again. Next step will be to figure out how to offer these local changes for merging by the person doing releases.

No comments: