/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
4634.38.1 by Ian Clatworthy
first cut at pdf docs via sphinx
1
=============================
2
Centralized Workflow Tutorial
3
=============================
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
4
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
5
6
Overview
7
========
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
8
6622.1.23 by Jelmer Vernooij
More renames in English docs.
9
This document describes a possible workflow for using Breezy_. That of
10
using Breezy_, the distributed version control system, in a centralized
11
manner. Breezy_ is designed to be very flexible and allows several
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
12
different workflows, from fully decentralized to mostly centralized.  The
13
workflow used here is meant to ease a new user into more advanced usage of
6622.1.23 by Jelmer Vernooij
More renames in English docs.
14
Breezy_, and allow them to work in a mix of centralized and decentralized
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
15
operations.
16
17
In general, this document is meant for users coming from a background of
18
centralized version control systems such as CVS or subversion. It is
19
common in work settings to have a single central server hosting the
20
codebase, with several people working on this codebase, keeping their work
21
in sync.  This workflow is also applicable to a single developer working
22
on several different machines.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
23
6650.1.1 by Jelmer Vernooij
Update homepage URL.
24
.. _Breezy: https://www.breezy-vcs.org/
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
25
26
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
27
Initial Setup
28
=============
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
29
6622.1.23 by Jelmer Vernooij
More renames in English docs.
30
These are some reasonably simple steps to setup Breezy_ so that it works
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
31
well for you.
32
33
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
34
Setting User Email
35
------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
36
37
Your user identity is stored with each commit. While this doesn't have to
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
38
be accurate or unique, it will be used in log messages and
39
annotations, so it is better to have something real.
40
4853.1.1 by Patrick Regan
Removed trailing whitespace from files in doc directory
41
::
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
42
6622.1.23 by Jelmer Vernooij
More renames in English docs.
43
   % brz whoami "John Doe <jdoe@organization.com>"
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
44
45
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
46
Setting up a local Repository
47
-----------------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
48
6622.1.23 by Jelmer Vernooij
More renames in English docs.
49
Breezy_ branches generally copy the history information around with them,
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
50
which is part of how you can work in a fully decentralized manner. As an
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
51
optimization, it is possible for related branches to combine their storage
52
needs so that you do not need to copy around all of this history
53
information whenever you create a new branch.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
54
2293.1.6 by Brad Crittenden
post review changes
55
The best way to do this is to create a `Shared Repository`_. In
56
general, branches will share their storage if they exist in a
57
subdirectory of a `Shared Repository`_.  So let's set up a `Shared
58
Repository`_ in our home directory, thus all branches we create
59
underneath will share their history storage.
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
60
61
::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
62
7385.2.1 by Jelmer Vernooij
Rename init-repo to init-shared-repo.
63
  % brz init-shared-repo --trees ~
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
64
65
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
66
Setting up a remote Repository
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
67
---------------------------------
68
69
Many times you want a location where data is stored separately from where
70
you do your work. This workflow is required by centralized systems
71
(CVS/SVN).  Usually they are on separate machines, but not always. This is
72
actually a pretty good setup, especially in a work environment. Since it
73
ensures a central location where data can be backed up, and means that if
74
something happens to a developer's machine, no committed work has to be
75
lost.
76
77
So let's set up a shared location for our project on a remote machine
78
called ``centralhost``. Again, we will use a
79
`Shared Repository`_ to optimize disk usage.
80
81
::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
82
7385.2.1 by Jelmer Vernooij
Rename init-repo to init-shared-repo.
83
  % brz init-shared-repo --no-trees brz+ssh://centralhost/srv/brz/
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
84
85
You can think of this step as similar to setting up a new cvsroot, or
6622.1.23 by Jelmer Vernooij
More renames in English docs.
86
subversion repository.  The ``--no-trees`` option tells brz to not
2293.1.6 by Brad Crittenden
post review changes
87
populate the directory with a working tree.  This is appropriate,
88
since no one will be making changes directly in the branches within
89
the central repository.
90
6622.1.23 by Jelmer Vernooij
More renames in English docs.
91
Here we're using a ``brz+ssh`` URL, which means to use Breezy's own
5761.1.1 by Martin Pool
Recommend SSH rather than SFTP in user documentation examples
92
protocol on top of the SSH secure shell.  See the Administrator Guide for
6622.1.23 by Jelmer Vernooij
More renames in English docs.
93
information about setting up a brz+ssh server.  
94
95
96
Migrating an existing project to Breezy
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
97
=======================================
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
98
99
Now that we have a repository, let's create a versioned project. Most of
100
the time, you will already have some code that you are working with,
6622.1.23 by Jelmer Vernooij
More renames in English docs.
101
that you now want to version using Breezy_. If the code was originally
102
in source control, there are many ways to convert the project to Breezy_
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
103
without losing any history. However, this is outside the scope of this
104
document. See `Tracking Upstream`_ for some possibilities (section
105
"Converting and keeping history").
106
5050.22.1 by John Arbash Meinel
Lots of documentation updates.
107
.. _Tracking Upstream: http://wiki.bazaar.canonical.com/TrackingUpstream
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
108
4853.1.1 by Patrick Regan
Removed trailing whitespace from files in doc directory
109
..
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
110
   XXX: We really need a different document for discussing conversion of a
111
   project. Right now TrackingUpstream is the best we have, though.
112
113
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
114
Developer 1: Creating the first revision
115
----------------------------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
116
117
So first, we want to create a branch in our remote Repository, where we
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
118
want to host the project.  Let's assume we have a project named
119
"sigil" that we want to put under version control.
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
120
121
::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
122
6622.1.23 by Jelmer Vernooij
More renames in English docs.
123
  % brz init brz+ssh://centralhost/srv/brz/sigil
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
124
125
This can be thought of as the "HEAD" branch in CVS terms, or as the "trunk"
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
126
in Subversion terms. We will call this the ``dev`` branch.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
127
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
128
I prefer working in a subdirectory of my home directory to avoid collisions with all
129
the other files that end up there. Also, we will want a project
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
130
directory where we can hold all of the different branches we end up
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
131
working on.
132
133
::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
134
135
  % cd ~
136
  % mkdir work
137
  % cd work
138
  % mkdir sigil
139
  % cd sigil
6622.1.23 by Jelmer Vernooij
More renames in English docs.
140
  % brz checkout brz+ssh://centralhost/srv/brz/sigil dev
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
141
  % cd dev
142
  % cp -ar ~/sigil/* .
6622.1.23 by Jelmer Vernooij
More renames in English docs.
143
  % brz add
144
  % brz commit -m "Initial import of Sigil"
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
145
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
146
2293.1.6 by Brad Crittenden
post review changes
147
In the previous section, we created an empty branch (the ``/sigil``
148
branch) on ``centralhost``, and then checkout out this empty branch
149
onto our workstation to add files from our existing project.  There
150
are many ways to set up your working directory, but the steps above
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
151
make it easy to handle working with feature/bugfix branches. And one
6622.1.23 by Jelmer Vernooij
More renames in English docs.
152
of the strong points of Breezy_ is how well it works with branches.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
153
154
At this point, because you have a 'checkout' of the remote branch, any
2293.1.6 by Brad Crittenden
post review changes
155
commits you make in ``~/work/sigil/dev/`` will automatically be saved
156
both locally, and on ``centralhost``.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
157
158
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
159
Developer N: Getting a working copy of the project
160
--------------------------------------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
161
162
Since the first developer did all of the work of creating the project,
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
163
all other developers would just checkout that branch. **They should
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
164
still follow** `Setting User Email`_ and `Setting up a local Repository`_.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
165
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
166
To get a copy of the current development tree::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
167
168
  % cd ~/work/sigil
6622.1.23 by Jelmer Vernooij
More renames in English docs.
169
  % brz checkout brz+ssh://centralhost/srv/brz/sigil dev
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
170
171
Now that two people both have a checkout of
6622.1.23 by Jelmer Vernooij
More renames in English docs.
172
``brz+ssh://centralhost/srv/brz/sigil``, there will be times when one of
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
173
the checkouts will be out of date with the current version.
6622.1.23 by Jelmer Vernooij
More renames in English docs.
174
At commit time, Breezy_ will inform the user of this and prevent them from
175
committing. To get up to date, use ``brz update`` to update the
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
176
tree with the remote changes. This may require resolving conflicts if the
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
177
same files have been modified.
178
179
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
180
Developing on separate branches
181
===============================
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
182
183
So far everyone is working and committing their changes into the same
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
184
branch. This means that everyone needs to update fairly regularly and
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
185
deal with other people's changes. Also, if one person commits something
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
186
that breaks the codebase, then upon syncing, everyone will get the
187
problem.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
188
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
189
Usually, it is better to do development on different branches, and then
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
190
integrate those back into the main branch, once they are stable. This is
191
one of the biggest changes from working with CVS/SVN. They both allow you
192
to work on separate branches, but their merging algorithms are fairly
6622.1.23 by Jelmer Vernooij
More renames in English docs.
193
weak, so it is difficult to keep things synchronized. Breezy_ tracks
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
194
what has already been merged, and can even apply changes to files that
195
have been renamed.
196
197
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
198
Creating and working on a new branch
199
------------------------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
200
201
We want to keep our changes available for other people, even if they
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
202
aren't quite complete yet. So we will create a new public branch on
203
``centralhost``, and track it locally.
204
205
::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
206
207
  % cd ~/work/sigil
6622.1.23 by Jelmer Vernooij
More renames in English docs.
208
  % brz branch brz+ssh://centralhost/srv/brz/sigil \
209
               brz+ssh://centralhost/srv/brz/sigil/doodle-fixes
210
  % brz checkout brz+ssh://centralhost/srv/brz/sigil/doodle-fixes doodle-fixes
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
211
  % cd doodle-fixes
212
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
213
We now have a place to make any fixes we need to ``doodle``. And we would
214
not interrupt people who are working on other parts of the code.  Because
215
we have a checkout, any commits made in the ``~/work/sigil/doodle-fixes/``
216
will also show up on ``centralhost``. [#nestedbranches]_ It is also
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
217
possible to have two developers collaborate on one of these branches, just
7192.3.13 by Jelmer Vernooij
Fix syntax.
218
like they would have collaborated on the ``dev`` branch.
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
219
220
.. [#nestedbranches] It may look odd to have a branch in a subdirectory of
221
   another branch. This is just fine, and you can think of it as a
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
222
   hierarchical namespace where the nested branch is derived from the
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
223
   outer branch.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
224
225
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
226
Merging changes back
227
--------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
228
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
229
When it is decided that some of the changes in ``doodle-fixes`` are ready
230
to be merged into the main branch, simply do::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
231
232
  % cd ~/work/sigil/dev
6622.1.23 by Jelmer Vernooij
More renames in English docs.
233
  % brz merge ../doodle-fixes
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
234
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
235
Now the changes are available in the ``dev`` branch, but they have not
236
been committed yet. This is the time when you want to review the final
237
changes, and double check the code to make sure it compiles cleanly and
6622.1.23 by Jelmer Vernooij
More renames in English docs.
238
passes the test suite. The commands ``brz status`` and ``brz diff`` are
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
239
good tools to use here. Also, this is the time to resolve any conflicts.
6622.1.23 by Jelmer Vernooij
More renames in English docs.
240
Breezy_ will prevent you from committing until you have resolved these
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
241
conflicts. That way you don't accidentally commit the conflict markers.
6622.1.23 by Jelmer Vernooij
More renames in English docs.
242
The command ``brz status`` will show the conflicts along with the other
243
changes, or you can use ``brz conflicts`` to just list conflicts. Use
244
``brz resolve file/name`` or ``brz resolve --all`` once conflicts have
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
245
been handled. [#resolve]_ If you have a conflict that is particularly
6622.1.23 by Jelmer Vernooij
More renames in English docs.
246
difficult to solve you may want to use the ``brz remerge`` command. It
2098.2.1 by John Arbash Meinel
Apply changes recommended by Alaa Salman
247
will let you try different merge algorithms, as well as let you see the
248
original source lines (``--show-base``).
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
249
250
.. [#resolve] Some systems make you resolve conflicts as part of the merge
251
   process. We have found that it is usually easier to resolve conflicts
252
   when you have the view of the entire tree, rather than just a single
253
   file. It gives you much more context, and also lets you run tests as
254
   you resolve the problems.
255
256
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
257
Recommended Branching
258
---------------------
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
259
260
One very common way to handle all of these branches is to give each
261
developer their own branch, and their own place to work in the central
262
location. This can be done with::
263
6622.1.23 by Jelmer Vernooij
More renames in English docs.
264
  % brz branch brz+ssh://centralhost/srv/brz/sigil \
265
               brz+ssh://centralhost/srv/brz/sigil/user-a
266
  % brz branch brz+ssh://centralhost/srv/brz/sigil \
267
               brz+ssh://centralhost/srv/brz/sigil/user-b
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
268
269
This gives each developer their own branch to work on. And, they can
7192.3.13 by Jelmer Vernooij
Fix syntax.
270
easily create a new feature branch for themselves::
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
271
6622.1.23 by Jelmer Vernooij
More renames in English docs.
272
  % brz branch brz+ssh://centralhost/srv/brz/sigil/user-a \
273
               brz+ssh://centralhost/srv/brz/sigil/user-a/feature
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
274
  % cd ~/work/sigil
6622.1.23 by Jelmer Vernooij
More renames in English docs.
275
  % brz checkout brz+ssh://centralhost/srv/brz/sigil/user-a/feature myfeature
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
276
277
2098.2.3 by John Arbash Meinel
Switch to automatic numbering for sections and sub-sections.
278
Glossary
279
========
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
280
281
Shared Repository
282
-----------------
283
6622.1.23 by Jelmer Vernooij
More renames in English docs.
284
Breezy_ has the concept of a "Shared Repository". This is similar to
4852.4.1 by Patrick Regan
Change references from Revision Control to Version Control
285
the traditional concept of a repository in other VCSs like CVS and
2293.1.6 by Brad Crittenden
post review changes
286
Subversion. For example, in Subversion you have a remote repository,
287
which is where all of the history is stored, and locally you don't
288
have any history information, only a checkout of the working tree
289
files. Note that "Shared" in this context means shared between
290
branches. It *may* be shared between people, but standalone branches
291
can also be shared between people.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
292
6622.1.23 by Jelmer Vernooij
More renames in English docs.
293
In Breezy_ terms, a "Shared Repository" is a location where multiple
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
294
branches can **share** their revision history information. In order to
295
support decentralized workflows, it is possible for every branch to
2293.1.6 by Brad Crittenden
post review changes
296
store its own revision history information. But this is often
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
297
inefficient, since related branches share history, and they might as
298
well share the storage as well.
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
299
300
4853.1.1 by Patrick Regan
Removed trailing whitespace from files in doc directory
301
..
1964.2.1 by John Arbash Meinel
Adding basic documentation about working with a central repository
302
   vim: tw=74 ft=rst spell spelllang=en_us