Memory Pool System branching and merging procedures

author Gareth Rees
confidentiality public
date 2014-01-09
organization Ravenbrook Limited
readership MPS developers

1. Introduction

This document contains procedures and checklists for branching and merging during the ordinary course of development. For making version branches, see version-create, and for making releases, see release-build.

2. Pre-branch checklist

  1. Have you created a job recording the problem you are planning to solve on the development branch?

3. Creating a development branch (automated procedure)

Run the script tool/branch, passing the options:

  • -P mps — project name
  • -p PARENT — parent branch: for example master or custom/cet/main
  • -C CHANGELEVEL — changelevel at which to make the branch
  • -t TASK — task name: for example lii6ll
  • -d "DESCRIPTION" — the description of the branch
  • -g - push this branch to GitHub.
  • -y — yes, really create the branch

If omitted, the project and parent branch are deduced from the current directory, and the changelevel defaults to the most recent change on the parent branch. So a typical invocation looks like this:

tool/branch -p master -t lii6ll -d "Adding new supported platform lii6ll (job003596)." -g -y

4. Creating a development branch (manual procedure)

  1. Create a branch specification. For example:

    p4 branch mps/branch/2013-08-21/lii6ll
    

    The specification should look like this:

    Branch: mps/branch/2013-08-21/lii6ll
    
    Description:
            Adding new supported platform lii6ll (job003596).
    
    View:
            //info.ravenbrook.com/project/mps/master/... //info.ravenbrook.com/project/mps/branch/2013-08-21/lii6ll/...
    
  2. If you're working on a problem that's specific to a customer, then map the mainline for that customer rather than the master sources:

    View:
            //info.ravenbrook.com/project/mps/custom/cet/main/... //info.ravenbrook.com/project/mps/branch/2013-11-04/cet-i6-stack-probe/...
    
  3. Populate the branch:

    p4 populate -b mps/branch/2013-08-21/lii6ll -d "Branching to add new supported platform lii6ll (job003596)."
    
  4. Edit the index of branches:

    p4 edit //info.ravenbrook.com/project/mps/branch/index.html
    

    and add an entry to the "Active branches" section.

5. Pre-merge checklist

  1. Have you solved the problem?
  2. Is there an automated test case?
  3. Does the test suite pass on all supported platforms?
  4. If there are interface changes, is there documentation?
  5. If the changes are significant and user-visible, have you updated the release notes (master/manual/source/release.rst)?
  6. If this is work on a customer-specific branch, and you've added new customer-specific interfaces, have you ensured that these interfaces are separated from the public interfaces?
  7. If this is work on a customer-specific branch, and you've added new files that should be merged into the mainline for that customer, but not into the master sources, have these files been excluded in the branch specification for that customer?
  8. Has there been a code review?

6. Merging a development branch

  1. Do a catch-up merge from the master sources (or the appropriate customer-specific mainline):

    BRANCH=mps/branch/2013-08-21/lii6ll
    p4 integrate -b $BRANCH
    p4 resolve -as
    p4 resolve
    
  2. Check that the test suite passes on the branch.

  3. Submit the merged files:

    p4 submit -d "Catch-up merge from the master sources to $BRANCH"
    
  4. Update the branch on all supported platforms and check that the test suite passes.

  5. Backward merge into the master sources (or the appropriate customer-specific mainline):

    p4 integrate -r -b $BRANCH
    p4 resolve -as
    p4 resolve
    

    Note: don't cherry-pick individual lines from files, if at all possible. (It may not be possible in the case of makefiles.) Try to structure changes so that files can be included or excluded as a whole.

  6. Check that the test suite passes on the master sources.

  7. Submit the merged files:

    p4 submit -d "Merge $BRANCH into the master sources"
    
  8. Create a fix record for the change you just submitted:

    p4 fix -c CHANGE JOB
    
  9. Edit the branch index, moving the development branch from the "Active branches" to "Dormant branches" section and linking the change in which the branch was merged.

A. References

B. Document History

2014-01-09 GDR Created.
2014-03-19 GDR Describe automated procedure.
2018-08-18 DL Added github flag reflecting current practice.
2020-07-28 PNJ Updated licence text.