Development
The Open Chemistry projects use git for version control, and Gerrit for code review. The source code is mirrored on our infrastructure, Github and Gitorious. These are read only mirrors, only the Gerrit hosted copy of the repository can be edited. Once topic braches are merged in using the Gerrit interface they are automatically replicated to these three locations.
Refer to the build page for details of setting up and building the Open Chemistry project.
Getting Started
First you should go to http://review.source.kitware.com/ and log in using a valid OpenID (GMail has an OpenID and the email can be customized in Gerrit).
- Go to Settings and configure your username (under profile)
- Upload your public SSH key (under SSH public keys)
- Ensure your name and email address are correct (under contact information)
These details will be used later.
Cloning Repositories
You should clone the repositories from our source code hosting infrastructure, or the Github/Gitorious mirror. You should also track changes from here as the cloning/update process will be faster, and is always in sync with Gerrit. To clone the Open Chemistry repository that contains the other projects as submodules,
git clone --recursive git://github.com/OpenChemistry/openchemistry.git
Setting up for Development
Now you have successfully cloned the source code there is a little set up required. We have prepared a shell script which takes care of most of these details for you, which can be run interactively (or inspected and copy/pasted as required). In order to set up your new clone, change in to the directory and run the set up script.
./scripts/setup-for-development.sh
You will be prompted for details as required, defaults are shown in brackets. Pay close attention to the Gerrit username and authentication test if online (to verify SSH authentication works as expected). This will set up a gerrit remote, local git hooks (including one to automatically generate Change-Id lines) and ensure your name/email address is correct. It will also add a new git alias to push changes to Gerrit for review.
This must be done for each git repository you wish to develop. If you wish to develop AvogadroLibs you would need to cd into 'avogadrolibs' and then run the setup for development script in that repository.
Updating
In order to update the repository from the openchemistry module you can run,
git pull git submodule update --init
If you wish to checkout the master branch of a particular submodule and get the latest updates,
cd avogadrolibs git checkout master git pull
This is preferred before starting any development topics.
Uploading Proposed Changes
You should develop all code on topic branches, branched from master.
git checkout -b topic-name
Once you are ready to commit, use the commit command as normal. When you would like to have your proposed changes reviewed use the git alias to push the changes.
git gerrit-push
The changes will appear on Gerrit, appropriate reviewers should be added. Once the topic is ready it will be merged using Gerrit, and replicated automatically.