FusionForge

Maintaining a patched version with Bazaar

From FusionForge Wiki
Revision as of 15:36, 2 November 2011 by Lolando (talk | contribs) (Started documenting a workflow for local branches)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are times where the vanilla FusionForge doesn't quite fit your own particular needs; while you can of course do the changes locally on the installed forge, you'd still like to keep track of the upstream FusionForge code and take advantage of the evolutions there. And at some point, you may even want to contribute some of your local changes, because if they're not 100% specific to you there are good chances that they'll be useful to someone out there. But you're worried about getting lost in a maze of branches, merges and so on.

This is a possible workflow, using Bazaar as the DVCS. User:Lolando has used it successfully to manage several sets of branches for clients who require slightly patched versions of FusionForge.

One patch

Let's assume that Acme Ltd. wants to deploy their AcmeForge, based on the latest stable series of FusionForge (5.1.x at the time of writing, coming from the branch called Branch_5_1 in the fusionforge.org Subversion repository), with a customized theme that's only a minor deviation from the standard theme (adding a few links, changing the colours in the CSS, etc.).

We'll first create a local repository to save disk space, and copy the upstream branch there:

$ bzr init-repo acmeforge
Shared repository with trees (format: 2a)
Location:
  shared repository: acmeforge
$ cd acmeforge
~/acmeforge $ bzr branch http://fusionforge.fusionforge.org/bzr/branches/Branch_5_1
Branched 10435 revision(s).                                                     
~/acmeforge $ 

Then we'll create our local branch, called "patched":

~/acmeforge $ bzr branch Branch_5_1 patched
Branched 10435 revision(s).                                                                     
~/acmeforge $ 

Time to do some local work!

~/acmeforge $ cd patched/
~/acmeforge/patched $ emacs src/www/themes/gforge/Theme.class.php
[…]
~/acmeforge/patched $ bzr commit -m"Patched default theme to match Acme Corp's colours"
Committing to: /home/guest/acmeforge/patched/
modified src/www/themes/gforge/Theme.class.php
Committed revision 10436.
~/acmeforge/patched $ emacs src/www/themes/gforge/Theme.class.php
[…]
~/acmeforge/patched $ bzr commit -m"Fixed a syntax error introduced with the previous commit"
Committing to: /home/guest/acmeforge/patched/
modified src/www/themes/gforge/Theme.class.php
Committed revision 10437.                                                                 
~/acmeforge/patched $

We can now deploy the code based on this "patched" branch, either by building the *.deb or *.rpm packages or installing from source. If further rounds of the local patch are needed, just edit and commit, and deploy again from that branch.

Now what happens when the upstream 5.1.x branch evolves? We want to integrate these changes into our patched forge, and not lose our changes. Here's how:

~/acmeforge $ cd Branch_5_1/
~/acmeforge/Branch_5_1 $ bzr pull
Using saved parent location: http://fusionforge.fusionforge.org/bzr/branches/Branch_5_1/
 M  src/common/include/FusionForge.class.php
All changes applied successfully.
Now on revision 10436.
~/acmeforge/Branch_5_1 $ cd ../patched/
~/acmeforge/patched $ bzr merge ../Branch_5_1/
 M  src/common/include/FusionForge.class.php                                                                      
All changes applied successfully.                                                                  
~/acmeforge/patched $ bzr commit -m"Merged from upstream 5.1 branch"
Committing to: /home/guest/acmeforge/patched/                                                 
modified src/common/include/FusionForge.class.php
Committed revision 10438.                                                                 
~/acmeforge/patched $                                                             

Our "patched" branch now has both the latest changes from upstream and the local changes to the theme, and it can be deployed as previously.

Several independent patches