~bzr-pqm/bzr/bzr.dev

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