1
Organizing your workspace
2
=========================
4
Common workspace layouts
5
------------------------
7
The best way for a Bazaar user to organize their workspace for a project
8
depends on numerous factors including:
10
* user role: project owner vs core developer vs casual contributor
12
* workflows: particularly the workflow the project encourages/mandates
13
for making contributions
15
* size: large projects have different resource requirements to small ones.
17
There are at least 4 common ways of organizing one's workspace:
19
* lightweight checkout
24
A brief description of each layout follows.
30
In this layout, the working tree is local and the branch is remote.
31
This is the standard layout used by CVS and Subversion: it's simple
36
bzr checkout --lightweight URL project
46
Note that each commit implicitly publishes the change to everyone else
47
working from that branch. However, you need to be up to date with changes
48
in the remote branch for the commit to succeed. To grab the latest code
49
and merge it with your changes, if any::
57
In this layout, the working tree & branch are in the one place. Unless
58
a shared repository exists in a higher level directory, the repository
59
is located in that same place as well. This is the default layout in
60
Bazaar and it's great for small to moderately sized projects.
64
bzr branch URL project
74
To publish changes to a central location::
78
The URL for push is only required the first time.
80
If the central location has, in the meantime, received changes from
81
other users, then you'll need to merge those changes into your local
82
branch before you try to push again::
88
As an alternative, a checkout can be used. Like a branch, a checkout
89
has a full copy of the history stored locally but the local branch
90
is bound to the remote location so that commits are published to
91
both locations at once.
93
Note: A checkout is actually smarter than a local commit followed by
94
a push. In particular, a checkout wil commit to the remote location
95
first and only commit locally if the remote commit succeeds.
101
In this layout, there are multiple branches/trees, typically sharing
102
a repository. One branch is kept as a mirror of "trunk" and each
103
unit-of-work (i.e. bug-fix or enhancement) gets its own "feature branch".
104
This layout is ideal for most projects, particularly moderately sized ones.
108
bzr init-repo project
112
To start a feature branch::
114
bzr branch trunk featureX
124
To publish changes to a mailing list for review & approval::
128
To publish changes to a public branch (that can then be registered as
129
a Launchpad merge request, say)::
133
As a variation, the trunk can be created as a checkout. If you have
134
commit privileges on trunk, that lets you merge into trunk and the
135
commit of the merge will implicitly publish your change. Alternatively,
136
if the trunk URL is read-only (e.g. a http address), that prevents
137
accidental submission this way - ideal if the project workflow uses
138
an automated gatekeeper like PQM, say.
144
This layout is very similar to the feature branches layout except that
145
the feature branches share a single working tree rather than having one
146
each. This is similar to git's default layout and it's useful for projects
147
with really large trees (> 10000 files say) or for projects with lots of
148
build artifacts (like .o or .class files).
152
bzr init-repo --no-trees project
155
bzr checkout --lightweight trunk sandbox
158
While you *could* start making changes in sandbox now, committing while
159
the sandbox is pointing to the trunk would mean that trunk is no longer
160
a mirror of the upstream URL (well unless the trunk is a checkout).
161
Therefore, you usually want to immediately create a feature branch and
162
switch your sandbox to it like this::
164
bzr branch ../trunk ../featureX
165
bzr switch ../featureX
167
The processes for making changes and submitting them are otherwise
168
pretty much the same as those used for feature branches.
174
If you wish, you can put together your own layout based on how **you** like
175
things organized. See `Advanced shared repository layouts
176
<shared_repository_layouts.html>`_ for examples and inspiration.