Changes between Version 7 and Version 8 of BranchingPolicy

02/10/11 12:05:28 (3 years ago)

update for new policy


  • BranchingPolicy

    v7 v8  
    11= Branching Policy = 
    3 CKAN is stored in a mercurial repo and we have devised this policy to cope with coding, releasing and maintaining versions of the software. 
     3CKAN is stored in a mercurial repo. This policy covers development and branching policy for this repo. 
    5 This is based on the [ system used to develop Python], but instead of naming branches after their version numbers, they are named after the maturity of the release, which suits our more frequent releases. This allows `metastable` to always to be a beta, `stable` to be the latest solid release and `ultrastable` to be the previous-but-one release. 
     5= General: One Branch per Feature and Defect = 
    7 == Branches == 
     7We will be following the process described in (1) but applied to mercurial. Key aspects: 
    9 We have a number of maintained branches of the code to reflect their uses: 
     9 1. There will be three 'core' branches: "stable", "metastable" and "default" (in article stable=master and develop=default) 
     10  * stable: stable code 
     11  * metastable: (will soon be deprecated) for code preparing to be stable 
     12  * default: development HEAD 
     13 2. A (named) branch will be created for each feature or defect (bug). Naming convention: 
     14  * defect-{ticket-number}[-optional-name] e.g. defect-902-my-bad-bug 
     15  * feature-{ticket-number}[-optional-name] e.g. feature-903-my-amazing-feature 
     16 3. A (named) branch will be created for each release: release-v{release-number} e.g. release-v1.3 
    11 '''default''' branch is for future releases - New features go here. Bug fixes should always go here as well as the other branches. 
     18Feature, bug and release branches may be "closed" once appropriately merged. To summarize the work-flow: 
    13 '''metastable''' branch is for beta releases and proper releases deployed to and similar servers. These servers get new features first. Sometimes there are issues to be resolved with these new features. It usually lags `default`. 
     20 * No (or almost no) work should be done in default or stable directly. Work in branches. 
     21 * feature branches branch off default and merge back into default 
     22 * defect branches branch off default *or* stable and merge back into respective branches. Fixes on stable get merged to default as appropriate. 
     23  * NB: if a fix needs to go from default to stable (it happens!) then you can use mercurial's transplant (as you obviously must *not* merge from default to stable) 
     24 * release branches branch off metastable (in future off stable) 
    15 '''stable''' branch is the latest proper release. It usually lags `metastable`. 
     26More in article (1). 
    17 '''ultrastable''' branch is for the most stable code - proper releases, always one behind `stable`. 
     28We also strongly recommend that users push *by default* to their own personal repo rather than the main repo. This allows for code review by another dev before merging into the main repo and should reduce the number of "oops, I've pushed and broken the build" moments. 
    19 == Merging between the branches == 
     30== Closing Branches == 
    21 This arrangement can be seen to be like a waterfall of changesets. `default` has the most, `metastable` is a subset of `default`, `stable` a subset of `metastable` etc. As the releases go down the waterfall, the bug-fixes go in the opposite direction: 
    23  * A branch may need a bug-fix, and this would need to be merged to all branches UP the waterfall. Even if the bug-fix no longer applies on `default` (because say the file in question has been completely refactored in the meantime), this isn't a bad thing, since you'll be alerted when you get a conflict during the merge. 
    24  * Along with the bug-fix it may be worth adding a version change (e.g. `1.2` to `1.2.1`). This would also be usefully merged with the bug-fix up the waterfall, indicating the bug is fixed in these places too. 
    26 Unless there is a big need for a bug fixes on the more stable branches, bug fixes are best done on `metastable` (and then merged just to `default`). This saves the more stable branches from the risk of bug fixes causing other bad effects. 
    28 So the rule is: 
    29  * Releases are merged DOWN the waterfall: `default` -> `metastable` -> `stable` -> `ultrastable` 
    30  * Bug fixes should be merged UP the waterfall: `default` <- `metastable` ( <- `stable` <- `ultrastable` ) 
    32 It is good to merge all branch changes up the waterfall to the top, so that you don't forget to apply a bugfix to a higher branch. In the process  of doing this, you close the branch heads on the way. So when you push new changesets onto a branch (aside from `default`), you should expect to be reminded to create a new head (`hg push -f`). 
    34 (We've not thought of a use case that needs this, but there is a possibility that you want to make a change to a branch, which you don't want merged up the waterfall and wouldn't cause a conflict. If this should arise you can still merge upwards, but manually revert the change before committing it. But this would be against the grain of this waterfall model and if this becomes frequent, this policy should be reconsidered.) 
    36 If you merge bug fixes the wrong way (i.e. down the waterfall), you may well end up with unstable changesets merged as well as the bugfix! If you find you have fixed a bug on a higher branch than necessary and want to have the bugfix on a lower branch, then you need to 'transplant' the changeset, rather than 'merge'. 
     33hg up -r {branch-name} 
     34hg ci --close-branch {branch-name} 
     35# may now want to merge to default or you'll be left with a dangling head 
     36hg up -r default 
     37hg merge -r {branch-name} 
    3840== Transplanting changesets == 
    40 When you merge, you can't cherry pick changesets - you have to take all of them up to a certain one. So you have to be slightly more cunning to 'transplant' a bugfix changeset down the waterfall. 
    42 You can either use the mercurial 'transplant' extension or use `hg export` and `hg import`.  
     42When you merge, you can't cherry pick changesets - you have to take all of them up to a certain one. In these cases transplant can be useful to copy a changeset across (though mercurial will not be aware of this copy). 
    4444== 'tip' note == 
    4646Mercurial tags the latest commit with the tag `tip`. This means it changes on every commit and might be on ''any'' branch. So it's best not to refer to it in documentation, emails or changeset comments. 
     48= Further references = 
     50 1. 
     51 2. 
     52 3. 
     53 4. 
     54 5. Original thread