launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/doc/bazaar-pipelines.txt (about)

     1  Bazaar Pipelines
     2  ================
     3  
     4  Pipelines are implemented using a bazaar plugin.
     5  
     6    $ mkdir -p ~/.bazaar/plugins
     7    $ bzr branch lp:bzr-pipeline ~/.bazaar/plugins/pipeline
     8  
     9  Basic info for pipelines can be found using `bzr help pipeline`.
    10  
    11  Pipelines require lightweight checkouts, but that is how `cobzr` and how the
    12  recommendations are specified in the `bazaar-usage.txt` document.
    13  
    14  
    15  Why use pipelines
    16  =================
    17  
    18  Pipelines could be thought of as a doubly linked list of dependent branches.
    19  
    20  Often when working you need to break up the implementation, either because the
    21  work can be more easily reviewed as a collection of small independent changes,
    22  or the work can be landed incrementally.
    23  
    24  Another reason is to avoid mixing new work with other refactoring that occurs
    25  during the process of writing the new work.  Often when adding new features,
    26  other parts of code need to change.  The branch is easier to review if the
    27  prerequisite changes happen seperately.
    28  
    29  Sometimes you don't know you want to refactor things until half of it is done
    30  already.  In this situation you can create a new pipe before the current one,
    31  and move the changes into it.
    32  
    33    $ bzr add-pipe --before some-refactoring-work
    34    $ bzr merge -i :next
    35  
    36  This enters you into an interactive merge of the changes from the next branch
    37  in the pipeline.
    38  
    39  
    40  Merging trunk
    41  =============
    42  
    43  When merging trunk into a pipeline, you should move to the first branch in the
    44  pipeline.
    45  
    46    $ bzr switch :first
    47    $ bzr merge <trunk>
    48    # resolve any conflicts that may be there
    49    $ bzr commit -m "Merge trunk"
    50    $ bzr pump
    51  
    52  The pump command is effectively merging each pipe into the next pipe and
    53  commits without changing the current active pipe.  The pump command starts
    54  with the active pipe.  If there are conflicts from any particular merge, the
    55  pumping stops, and the active branch is set to be the branch that had the
    56  conflicts ready for you to fix the conflicts.
    57  
    58  
    59  Useful aliases
    60  ==============
    61  
    62    $ bzr alias pipes="show-pipeline"
    63  
    64  Show the branches in the pipeline.  All branches are considered a pipeline
    65  with one branch, so you can run this on any branch (actually a lightweight
    66  checkout). The current pipe is shown with an `*` at the start of the line.
    67  
    68    $ bzr alias next="switch-pipe :next"
    69    $ bzr alias prev="switch-pipe :prev"
    70  
    71  These two aliases allow you to move around the pipeline using:
    72  
    73    $ bzr next   # move to the next branch in the pipeline
    74    $ bzr prev   # move to the previous branch in the pipeline
    75  
    76  
    77    $ bzr alias pdiff="diff -r branch::prev"
    78  
    79  Show me the differences that this branch has introduced compared to the
    80  previous branch in the pipeline.
    81  
    82    $ bzr alias unpumped="missing --mine :next"
    83  
    84  Show the revisions that are in the current branch that are not yet in the next
    85  branch in the pipeline.
    86