Development Process
This page describes the development process for developing GnuCash code. It talks about how we use Subversion and in particular how we use branches to manage the GnuCash source code and release process.
Contents
Development Process Goals
The goal of this process is to limit the number of potential bugs that enter the stable release branch(es) due to changes made to the sources. We want to make sure that changes made to releases have been audited and vetted BEFORE they are commited to the release branches. At the same time we want to try to keep the main development branch as stable as practical.
In particular, we want to prevent "bad releases". Those are releases where a bugfix inadvertantly breaks other code.
Branches
Branches in Subversion are relatively cheap, therefore we should use branches to our advantage. There are always two "interesting" branches in use:
- trunk -- the main development branch
- branches/<release> -- the current release branch(es)
Developers may also have other branches in use for development or bugfixing. This is described later in this document.
Developing New Features
All development should target the trunk branch. This includes new features, bug fixes, and enhancements. Small changes can be commited directly to trunk. Larger features or architectural changes should happen on a feature-branch; once that feature is working it can get merged back into trunk.
At any particular time, trunk should be "as stable as possible". We use feature branches to limit the chance that a feature never completes. If development of a feature were done solely in trunk and that feature never got completed it could leave trunk in a state where it doesn't compile, or it fails the regression tests.
If you are at all questioning whether to develop directly in trunk or in a branch, do it in a branch.
Minor Changes
Minor changes may be commited directly to trunk.
Major Changes
Use your judgement about whether your major change should be done directly on trunk or whether you should use a development branch. We trust you. Just remember, smaller changesets are easier to audit. Also keep in mind that svn blame is going to point to the "merge" changeset and not the individual changeset after your development branch is merged into trunk.
Fixing Bugs
Contrary to some beliefs, bug fixing is still development; it's just a different type of development. Indeed, whenever a bug exists that bug most likely exists in all branches, so it should get fixed in all branches. Therefore, the bugfix process should provide a way to fix a bug in trunk and, when necessary or appropriate, also on release branches.
Fixing bugs leads to its own set of issues, especially due to the fact that trunk will diverge from the release branches. Some may think that it would be easier to just commit bugfixes directly to the release branch and then merge back into trunk, but while this might require fewer command-line operations, it has many pitfalls.
Pitfalls of fixing directly on a release branch
- it requires unvetted changes be committed to the release branch
- it fails to work well if we have multiple release branches
- as trunk diverges, the merging can become even more challenging. While cherry-picking changesets to pull into a release branch requires typing more commands, merging a large set of changes from the release branch back into trunk can become a huge tangled mess if any of the changes don't apply cleanly.
- when looking at a change in trunk to see why a line of code changed svn blame would only show that the change came from a "merge from stable branch" instead of showing who actually made the change or why.
It is true that as trunk diverges some bugfixes might require a lot of work to "backport" to the release branch (assuming that the fix even IS a backport). In that case, the developer should use a bugfix branch (based off the release branch) to work on the fix. However, that same bugfix if made in the release branch would require the same amount of work to merge into trunk so it's not saving any work to do it that way, and there are many drawbacks to the approach.
Bugfix Branches
Many times a bugfix is simple and the code has not diverged. In that case the bug can be fixed on trunk and the changeset can be merged (cherry picked) directly onto the release branch. This will happen more often than not early on in the development cycle because trunk and the release started the same. As time goes on it may happen less often depending on the actual change and how much the code has diverged.
If the code has diverged enough that a simple bugfix can't be applied, or the bugfix is sufficiently complicated, then that bugfix warrants a bugfix branch. The developer can create a branch off the release branch to work on the bugfix, and once that's been tested that branch can be merged back into the release branch. Note that the bug should STILL be fixed in trunk first.
Changeset Auditing Process
All changes to a release branch must be audited.
- Before any changes may be made to a release branch, the changeset should exist either in trunk (if it's a simple fix) or a specific bugfix branch (if the changeset is complicated enough that it just can't apply cleanly). This way the change is already in Subversion and has a chance to be vetted before pulled onto the release branch.
- Developers should request changesets get audited and approved before they are pulled into the release branch. These requests should be made on the mailing list or potentially on IRC.
- Any change that gets requested to merge onto a release branch should have an associated entry in Bugzilla. The bug should contain the changeset number with the bugfix in trunk (or the name of the bugfix branch). You should mark this bug as a blocker of Bug #347575, which is the catch-all for keeping track of backport requests. Once the requested and audited change is pulled into the release branch the bug will get closed.
Updating Translations
Translations are "special". Translation updates can be made directly into the po directory of the release branch.