~bzr-pqm/bzr/bzr.dev

2977.1.6 by Ian Clatworthy
first cut at Central development chapter
1
Publishing a branch
2
===================
3
4
Setting up a central repository
5
-------------------------------
6
7
While the centralized workflow can be used by socially nominating
8
any branch on any computer as the central one, in practice most
9
teams have a dedicated server for hosting central branches.
10
11
Just as it's best practice to use a shared repository locally,
12
it's advisable to put central branches in a shared repository.
13
Note that central shared branches typically only want to
14
store history, not working copies of files, so their enclosing
15
repository is usually creating using the ``no-trees`` option, e.g.::
16
3918.1.1 by Jari Aalto
In user guide, use 'PROJECT' as a metavariable not 'X-repo'
17
  bzr init-repo --no-trees sftp://centralhost/srv/bzr/PROJECT
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
18
19
You can think of this step as similar to setting up a new cvsroot or
3104.2.3 by Ian Clatworthy
make Choosing a shared repsoitory layout an appendix
20
Subversion repository. However, Bazaar gives you more flexibility
21
in how branches may be organised in your repository. See
4634.39.41 by Ian Clatworthy
Fix the broken links in the User Guide
22
`Advanced shared repository layouts <shared_repository_layouts.html>`_
23
in the appendices for guidelines and examples.
3104.2.3 by Ian Clatworthy
make Choosing a shared repsoitory layout an appendix
24
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
25
26
Starting a central branch
27
-------------------------
28
29
There are two ways of populating a central branch with some initial
30
content:
31
32
 1. Making a local branch and pushing it to a central location
33
 2. Making an empty central branch then committing content to it.
34
35
Here is an example of the first way::
36
3918.1.1 by Jari Aalto
In user guide, use 'PROJECT' as a metavariable not 'X-repo'
37
  bzr init-repo PROJECT  (prepare local repository)
38
  bzr init PROJECT/trunk
39
  cd PROJECT/trunk
40
			 (copy development files)
41
  cp -ar ~/PROJECT .     (copy files in using OS-specific tools)
42
  bzr add                (populate repository; start version control)
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
43
  bzr commit -m "Initial import"
3918.1.1 by Jari Aalto
In user guide, use 'PROJECT' as a metavariable not 'X-repo'
44
                         (publish to central repository)
45
  bzr push sftp://centralhost/srv/bzr/PROJECT/trunk
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
46
47
Here is an example of the second way::
48
3918.1.1 by Jari Aalto
In user guide, use 'PROJECT' as a metavariable not 'X-repo'
49
  bzr init-repo PROJECT  (prepare local repository)
50
  cd PROJECT
51
  bzr init sftp://centralhost/srv/bzr/PROJECT/trunk
52
  bzr checkout sftp://centralhost/srv/bzr/PROJECT/trunk
53
  cd trunk
54
  cp -ar ~/PROJECT .     (copy files in using OS-specific tools)
55
  bzr add                (populate repository; start version control)
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
56
  bzr commit -m "Initial import"
3918.1.1 by Jari Aalto
In user guide, use 'PROJECT' as a metavariable not 'X-repo'
57
                         (publish to central repository)
58
  bzr push sftp://centralhost/srv/bzr/project/trunk
2977.1.6 by Ian Clatworthy
first cut at Central development chapter
59
60
Note that committing inside a working tree created using
61
the ``checkout`` command implicitly commits the content to
62
the central location as well as locally. Had we used the
63
``branch`` command instead of ``checkout`` above, the
64
content would have only been committed locally.
65
66
Working trees that are tightly bound to a central location
67
like this are called *checkouts*. The rest of this chapter
68
explains their numerous features in more detail.