4
Turning a branch into a checkout
5
--------------------------------
7
If you have a local branch and wish to make it a checkout, use the
8
``bind`` command like this::
10
bzr bind sftp://centralhost/srv/bzr/PROJECT/trunk
12
This is necessary, for example, after creating a central branch using
13
``push`` as illustrated in the previous section.
15
After this, commits will be applied to the bound branch before
16
being applied locally.
18
Turning a checkout into a branch
19
--------------------------------
21
If you have a checkout and wish to make it a normal branch, use the
22
``unbind`` command like this::
26
After this, commits will only be applied locally.
31
When working in a team using a central branch, one person needs
32
to provide some initial content as shown in the previous section.
33
After that, each person should use the ``checkout`` command to
34
create their local checkout, i.e. the sandbox in which they
35
will make their changes.
37
Unlike Subversion and CVS, in Bazaar the ``checkout`` command creates a
38
local full copy of history in addition to creating a working tree holding
39
the latest content. This means that operations such as ``diff`` and ``log``
40
are fast and can still be used when disconnected from the central location.
42
.. _getting-a-lightweight-checkout:
44
Создание легковесной рабочей копии
45
----------------------------------
47
While Bazaar does its best to efficiently store version history, there
48
are occasions when the history is simply not wanted. For example, if your
49
team is managing the content of a web site using Bazaar with a
50
central repository, then your release process might be as simple as
51
updating a checkout of the content on the public web server. In this
52
case, you probably don't want the history downloaded to that location
55
* wastes disk space holding history that isn't needed there
56
* exposes a Bazaar branch that you may want kept private.
58
To get a history-less checkout in Bazaar, use the ``--lightweight``
61
bzr checkout --lightweight sftp://centralhost/srv/bzr/PROJECT/trunk
63
Of course, many of the benefits of a normal checkout are lost by doing
64
this but that's a tradeoff you can make if and when it makes sense.
66
The ``--lightweight`` option only applies to checkouts, not to all branches.
68
Note: If your code base is really large and disk space on your computer
69
is limited, lightweight checkouts may be the right choice for you.
70
Be sure to consider all your options though including
71
`shared repositories <#a-reminder-about-shared-repositories>`_,
72
`stacked branches <#using-stacked-branches>`_, and `reusing a checkout`_.
74
Updating to the latest content
75
------------------------------
77
One of the important aspects of working in lockstep with others is
78
keeping your checkout up to date with the latest changes made to
79
the central branch. Just as you would in Subversion or CVS, you do
80
this in Bazaar by using the ``update`` command like this::
84
This gets any new revisions available in the bound branch and
85
merges your local changes, if any.
87
Handling commit failures
88
------------------------
90
Note that your checkout *must* be up to date with the bound branch
91
before running ``commit``. Bazaar is actually stricter about this
92
than Subversion or CVS - you need to be up to date with the full
93
tree, not just for the files you've changed. Bazaar will ask you
94
to run ``update`` if it detects that a revision has been added to
95
the central location since you last updated.
97
If the network connection to the bound branch is lost, the commit will
98
fail. Some alternative ways of working around that are outlined next.