~bzr-pqm/bzr/bzr.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Publishing a branch
===================

Setting up a central repository
-------------------------------

While the centralized workflow can be used by socially nominating
any branch on any computer as the central one, in practice most
teams have a dedicated server for hosting central branches.

Just as it's best practice to use a shared repository locally,
it's advisable to put central branches in a shared repository.
Note that central shared branches typically only want to
store history, not working copies of files, so their enclosing
repository is usually creating using the ``no-trees`` option, e.g.::

  bzr init-repo --no-trees sftp://centralhost/srv/bzr/PROJECT

You can think of this step as similar to setting up a new cvsroot or
Subversion repository. However, Bazaar gives you more flexibility
in how branches may be organised in your repository. See
`Advanced shared repository layouts <shared_repository_layouts.html>`_
in the appendices for guidelines and examples.


Starting a central branch
-------------------------

There are two ways of populating a central branch with some initial
content:

 1. Making a local branch and pushing it to a central location
 2. Making an empty central branch then committing content to it.

Here is an example of the first way::

  bzr init-repo PROJECT  (prepare local repository)
  bzr init PROJECT/trunk
  cd PROJECT/trunk
			 (copy development files)
  cp -ar ~/PROJECT .     (copy files in using OS-specific tools)
  bzr add                (populate repository; start version control)
  bzr commit -m "Initial import"
                         (publish to central repository)
  bzr push sftp://centralhost/srv/bzr/PROJECT/trunk

Here is an example of the second way::

  bzr init-repo PROJECT  (prepare local repository)
  cd PROJECT
  bzr init sftp://centralhost/srv/bzr/PROJECT/trunk
  bzr checkout sftp://centralhost/srv/bzr/PROJECT/trunk
  cd trunk
  cp -ar ~/PROJECT .     (copy files in using OS-specific tools)
  bzr add                (populate repository; start version control)
  bzr commit -m "Initial import"
                         (publish to central repository)

Note that committing inside a working tree created using
the ``checkout`` command implicitly commits the content to
the central location as well as locally. Had we used the
``branch`` command instead of ``checkout`` above, the
content would have only been committed locally.

Working trees that are tightly bound to a central location
like this are called *checkouts*. The rest of this chapter
explains their numerous features in more detail.