~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/en/user-guide/stacked.txt

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Using stacked branches
2
2
======================
3
3
 
4
 
Motivation
5
 
----------
6
 
 
7
 
If you are working on a project, and you have read access to whose
8
 
public repository but do not have write access to it, using stacked
9
 
branches to backup/publish your work onto the same host of the public
10
 
repository might be an option for you.
11
 
 
12
 
Other scenarios for stacked branch usage include experimental branches
13
 
and code hosting sites. For these scenarios, stacked branches are
14
 
ideal because of the benefits it provides.
15
 
 
16
 
 
17
4
What is a stacked branch?
18
5
-------------------------
19
6
 
20
 
A stacked branch is a branch that knows how to find revisions in
21
 
another branch (the stacked-on branch). Stacked branches store just
22
 
the unique revisions that are not in the stacked-on branch, making
23
 
them faster to create and more storage efficient. In these respects,
24
 
stacked branches are similar to shared repositories. However, stacked
25
 
branches have additional benefits:
 
7
A stacked branch is a branch that knows how to find revisions
 
8
in another branch. Stacked branches store just the
 
9
unique revisions, making them faster to create and more
 
10
storage efficient. In these respects, stacked branches are
 
11
similar to shared repositories. However, stacked branches have
 
12
additional benefits:
26
13
 
27
14
* The new branch can be in a completely different location to the
28
15
  branch being stacked on.
34
21
  repository can be physically readonly to developers committing to stacked
35
22
  branches.
36
23
 
 
24
These benefits make stacked branches ideal for various scenarios
 
25
including experimental branches and code hosting sites.
 
26
 
37
27
 
38
28
Creating a stacked branch
39
29
-------------------------
73
63
 
74
64
This creates a new branch at ``my-url`` that is stacked on ``reference-url``
75
65
and only contains the revisions in the current branch that are not already
76
 
in the branch at ``reference-url``. In particular, ``my-url`` and
77
 
``reference-url`` can be on the same host, and the ``--stacked`` option
78
 
can be used additionally to inform ``push`` to reference the
79
 
revisions in ``reference-url``. For example::
80
 
 
81
 
  bzr push --stacked-on sftp://host/project --stacked sftp://host/user/stacked-branch
82
 
 
83
 
This usage fits the scenario described in the Motivation section.
84
 
 
85
 
 
86
 
.. The following text is hidden because bug 375013 breaks the example.
87
 
   When bug 375013 is fixed, we should unhide this text.
88
 
      - Andrew Bennetts, 10 March 2010
89
 
 
90
 
.. If the local branch was created as a stacked branch, then you can
91
 
.. use the ``--stacked`` option to ``push`` and the *stacked-on* location
92
 
.. will be implicit. For example::
93
 
.. 
94
 
..   bzr branch --stacked source-url my-dir
95
 
..   cd my-dir
96
 
..   (hack, hack, hack)
97
 
..   bzr commit -m "fix bug"
98
 
..   bzr push --stacked
 
66
in the branch at ``reference-url``.
 
67
 
 
68
If the local branch was created as a stacked branch, then you can
 
69
use the ``--stacked`` option to ``push`` and the *stacked-on* location
 
70
will be implicit. For example::
 
71
 
 
72
  bzr branch --stacked source-url my-dir
 
73
  cd my-dir
 
74
  (hack, hack, hack)
 
75
  bzr commit -m "fix bug"
 
76
  bzr push --stacked
99
77
 
100
78
 
101
79
Limitations of stacked branches
102
80
-------------------------------
103
81
 
104
 
Currently, you cannot commit to a stacked branch, due to `bug 375013`_.
105
 
 
106
 
.. _bug 375013: https://bugs.launchpad.net/bzr/+bug/375013
107
 
 
108
82
The important thing to remember about a stacked branch is that the
109
83
stacked-on branch needs to be available for almost all operations. This is
110
84
not an issue when both branches are local or both branches are on the
111
85
same server.
112
86
 
113
 
Similarly, because most of the history is stored in the stacked-on repository,
114
 
operations like ``bzr log`` can be slower when the stacked-on repository is
115
 
accessed via a network.
116
 
 
117
87
 
118
88
Changing branch stacking
119
89
------------------------