Understanding core terms and concepts

There are a handful of commonly used terms and concepts when working with branches.

trunk, master, and mainline

trunk, master, and mainline are common names for the main branch in a project, where most of the new development happens. These terms are equivalent; for simplicity, we will use the term trunk throughout this book.

Technically speaking, the trunk is no different from any other branch. What makes it special is the agreement among collaborators in the project to use this branch as the "official" version, and the basis for creating new branches for new development.

The trunk is typically not necessarily well-tested nor stable, though there are exceptions, and in general this depends on the working style adopted by the collaborators of the project.

The tip of a branch

The latest revision in a branch is often referred to as the tip, or the HEAD. These terms are equivalent; for simplicity, we will use the term tip throughout this book.

Source and target branches

In all branch operations, the direction of the operation is always significant, especially when the operation modifies one of the branches.

We will use the term source branch to refer to the branch where the operation starts from, or for a branch that is used in a read-only manner to copy data from. We will use the term target branch to refer to the branch that is the target of the operation, typically modified as a result of the operation.

For example:

  • When creating branchB based on branchA, we will call branchA the source and branchB the target.
  • When merging branchX into branchY, we will call branchX the source and branchY the target.
  • When pushing branchP onto branchQ, we will call branchP the source and branchQ the target.

Parent branch

When branchB is created based on another branch, branchA, then branchA is called the parent branch of branchB. In other words, the source branch that branchB was created from is its parent branch. Bazaar records this relationship in branchB, and it can be useful when you want to reference the parent branch in certain branch operations.

Diverged branches and the base revision

Two branches that have a common history only up to a certain revision, but a different history after that point are diverged branches.

The last common revision in two related but diverged branches is called the base revision. Identifying the base revision is important when merging branches, in order to find the unique revisions in each branch to be merged.

The whole point of having multiple branches is, of course, to diverge—make different kinds of changes, go in different directions. However, keep in mind that if the further two branches diverge from each other, it may be increasingly difficult to merge them back together later. This will be explained in more detail, later in this chapter.

Storing branch data

Although branches typically evoke the image of a directed graph of revisions, in terms of physical storage, the data of a branch in Bazaar is surprisingly simplistic—it consists of the internal revision ID of the last revision (branch tip), along with a few additional lightweight properties.

Since the metadata stored in each revision includes references to parent revisions, Bazaar can reconstruct the graph of the entire revision history by starting from the branch tip and following the parent relationships all the way until the initial revision.

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

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