Using stacked branches

The concept of stacked branches is a space-saving technique, which allows multiple branches to re-use a common repository to access common revisions. A branch can be stacked on another branch, which is called the stacked-on branch. The stacked branch will store only the new revisions that are added to it directly, and it will re-use the repository of the stacked-on branch, whenever it needs to access the older revisions.

This setup removes the limitation of shared repositories that all the branches must be created within the same directory tree. A branch can be stacked on any other branch to re-use its repository, as long as the branch and the repository are at a location that can be accessed in read-only mode.

In practice, stacked branches make it possible to designate a read-only master branch, and let team members create their own branches at any other location in an efficient way, without unnecessary duplication of common revisions. Creating new branches stacked on the master branch is fast and efficient, because the revision history does not need to be copied.

Stacked branches are most useful in a server environment, where multiple users need an efficient way to share revision data, without the limitation of creating all branches within the same shared repository. Such an advanced setup is beyond the scope of this book; we only explain the basics of the concept because it is used on Launchpad, and occasionally you may see it mentioned in the output of certain commands. For example:

$ bzr push lp:~bzrbook/bzrbook-examples/dinner-party-new
Using default stacking branch /+branch-id/707963 at chroot-64745232:///~bzrbook/bzrbook-examples/
Created new stacked branch referring to /+branch-id/707963. 	

When working with multiple branches of a project in your local environment, it is easiest to use a shared repository. However, if you ever need to create branches outside the shared repository, then stacked branches can be useful to speed up branch operations and avoid wasting disk space.

For more information on using stacked branches, refer to the following URL:

http://doc.bazaar.canonical.com/development/en/user-guide/stacked.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.46.130