You are here: Home / Devel Env / Bazaar / Merging branches

Merging branches

Merging post-merge contributions into a new branch

Once in a while, some developers cannot have their latest contributions merged into the trunk, in most cases because of timing, stability, or code quality issues. In order to continue developing in good conditions, they then need to synchronize their new branches with their most recent developments. This has to be done with good care.

Let's illustrate this now with the example of the 5.9.0 branches. Here is how to proceed properly:

  bzr get /5.9.0-private
  cd 5.9.0-private
  bzr merge /5.8.2-public
  bzr commit
  bzr push /5.9.0-private
  # ...
  # Perform some checks - let's suppose they succeed
  # ...
  # From now on, you work *exclusively* in your 5.9.0-private branch
  # ...

To make it very clear, the above lines are the proper way. You'll notice that what is imported from 5.9.0 is enhanced with the other branch and goes back to 5.9.0. The data transfers with the Abinit Forge always take place in the same history line.

However, the following is WRONG:

  cd 5.8.2-private
  bzr merge /5.9.0-public
  bzr commit
  # The following line is what makes it wrong
  bzr push --remember /5.9.0-private
  # The following line finishes to break the history of your new branches

To make this very clear as well, this is WRONG. In such a case, you're mixing 2 different history lines which do not have the same length. Indeed, the starting point of 5.8.2 was at revision 355, while that of 5.9.0 is at 473. When pushing into the new branch from the old one, Bazaar overwrites

What happens in such a case is that you loose part of the history of the trunk, which makes it extremely difficult and tedious to track down any problem arising from your branch. And once it has been merged into trunk, everything gets totally obfuscated.

When you manage your branches, please always remember that:

  • sooner or later, other people will have to access them;
  • software tools need to access them daily to check the status of your latest developments.

The more you pay attention to what you do, the more the people in charge of the Abinit Forge can spend time on improving the framework, instead of fixing issues.

Merging the branches of other developers

When you want to merge the developments of another developer, you should always contact the person before and merge exclusively from their public branch. Merges from a private branch have a high probability to break important components and are thus strictly prohibited.

One good practice is to plan well and coordinate joint efforts, so that the number of such merges is kept minimal. It is important to avoid criss-crosses as much as possible.