Stephen J. Turnbull
stephen at xemacs.org
Tue May 14 18:38:51 UTC 2013
Lucio Crusca writes:
> branch A become finished and stable: I need to implement that
> feature starting from the code of branch B and then, sometimes in
> the future, merge that feature into A when A will be stable.
It sounds like Branch B is more or less a subset of Branch A, but the
opposite is not true. You can approximate the way this would occur
naturally when using a VCS by
(1) create a common "project" directory (technically in Bazaar this is
called a "shared repository"), say /usr/local/src/project.
(2) do "bzr init-repo" in that directory.
(3) copy the contents of Branch B (the whole subtree) into say
(4) clean out all extraneous files (editor backups, objects and
libraries created by the build process)
(5) do "bzr init; bzr add; bzr commit -m 'Initialize stable branch
with existing stable code.'"
(6) cd into /usr/local/src/project again, and do "bzr branch stable
(7) cd into devel, and remove everything except the .bzr directory and
(8) copy all source files from Branch A to where they belong.
(9) do "bzr add; bzr commit -m 'Branch devel from stable using
existing unstable code.'"
It is possible to join two branches that were created independently,
but the strategy above is easier. Don't hesitate to experiment (note
that steps 3 and 8 say "copy", not "move"!) Even if your project is
huge or full of junk that takes a while to do all the cleaning and
copying, just do it. It's well worth the time. Even if you make a
mistake and need to redo the whole thing, you'll still be ahead of the
Note that I haven't actually executed the procedure above, so I may be
missing some command options or new and better ways of accomplishing
your ends. Also, you may be able to create a more detailed history
based on some of the editor backups in the tree, or by committing
files in groups that are related to a particular feature. It's surely
not worth doing so in branch B (stable). However, it might be worth
doing so in branch A (devel) if you expect the features to mature at
different rates. It's quite easy to cherrypick features if you have
separated out the relevant changes in separate commits. Doing the
separation may be a major annoying task, in which case it's probably
not worth it. But if you're lucky and the new features are mostly
concentrated in a few files and generally don't touch the same files,
it is probably worth asking for further advice.
More information about the bazaar