~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/development-repo.txt

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
==============================
 
2
Development repository formats
 
3
==============================
 
4
 
 
5
.. contents::
 
6
 
 
7
Using development repository formats
 
8
====================================
 
9
 
 
10
Motivation
 
11
----------
 
12
 
 
13
We believe that we can continue to gain substantial performance benefits
 
14
by altering the repository storage in bzr. The more feedback we can get
 
15
on the changes during the development process the better.
 
16
 
 
17
To make it possible to get more feedback we are going to expose the
 
18
current development formats to the users of our development trunk
 
19
'bzr.dev'. The technical details of the individual formats are at the
 
20
end of this document.
 
21
 
 
22
Format names
 
23
------------
 
24
 
 
25
The current development format will be called 'development'. Each time
 
26
the development format changes, the prior development format will be
 
27
renamed to e.g. 'development0', 'development1' etc.
 
28
 
 
29
When a release of bzr is done, all the older numbered development
 
30
formats will be removed from 'bzr.dev', so we will not be carrying the
 
31
code for them around indefinately. 
 
32
 
 
33
Support for upgrade and migration
 
34
---------------------------------
 
35
 
 
36
The preservation and renaming policy makes it quite safe for users to
 
37
test out development formats (though we cannot guarantee bugs of course
 
38
- it is development code):
 
39
 
 
40
 - users of a given development format can always get back onto regular
 
41
   formats by switching to the next bzr released version which is
 
42
   guaranteed to be able to upgrade from that development format.
 
43
 - users that routinely use bzr.dev should upgrade to the most recent 
 
44
   development version available before pulling in bzr.dev changes
 
45
   around release time, as that is when old format cleanups will occur.
 
46
 
 
47
We cannot guarantee backwards compatability though, because some of the
 
48
planned work may be 'upgrade only'. Please see ``bzr help formats`` for
 
49
the text of the 'development' format which will indicate its
 
50
compatability with other formats if you need to interoperate with
 
51
users or services that do not have bzr.dev.
 
52
 
 
53
Before converting to a development format
 
54
-----------------------------------------
 
55
 
 
56
Run a ``bzr check`` with the version of bzr that you will be using.
 
57
``bzr check`` gets updated as we find new things that are inconsistent
 
58
with existing repositories. While only a small number of repositories
 
59
are likely to have any given error, it is best to check just in case.
 
60
 
 
61
If ``bzr check`` reports a problem, run this command::
 
62
 
 
63
  bzr reconcile
 
64
 
 
65
Note that reconcile can take many hours, particularly if you are
 
66
reconciling one of the 'knit' or 'dirstate' format repositories. If you
 
67
have such a repository, consider upgrading it to 'pack-0.92' first,
 
68
which will perform reconcile significantly faster.
 
69
 
 
70
Creating a new development format branch
 
71
----------------------------------------
 
72
 
 
73
If you're starting a project from scratch, it's easy to make it a
 
74
``development`` one. Here's how::
 
75
 
 
76
  cd my-stuff
 
77
  bzr init --development
 
78
  bzr add
 
79
  bzr commit -m "initial import"
 
80
 
 
81
In other words, use the normal sequence of commands but add the
 
82
``--development`` option to the ``init`` command.
 
83
 
 
84
 
 
85
Creating a new development format repository
 
86
--------------------------------------------
 
87
 
 
88
If you're starting a project from scratch and wish to use a shared repository
 
89
for branches, you can make it a ``development`` repository like this::
 
90
 
 
91
  cd my-repo
 
92
  bzr init-repo --development .
 
93
  cd my-stuff
 
94
  bzr init
 
95
  bzr add
 
96
  bzr commit -m "initial import"
 
97
 
 
98
In other words, use the normal sequence of commands but add the
 
99
``--development`` option to the ``init-repo`` command.
 
100
 
 
101
Upgrading an existing branch or repository to development
 
102
---------------------------------------------------------
 
103
 
 
104
If you have an existing branch and wish to migrate it to
 
105
a ``development`` format, use the ``upgrade`` command like this::
 
106
 
 
107
  bzr upgrade --development path-to-my-branch
 
108
 
 
109
If you are using a shared repository, run::
 
110
 
 
111
  bzr upgrade --development ROOT_OF_REPOSITORY
 
112
 
 
113
to upgrade the history database. Note that this will not
 
114
alter the branch format of each branch, so
 
115
you will need to also upgrade each branch individually
 
116
if you are upgrading from an old (e.g. < 0.17) bzr.
 
117
More modern bzr's will already have the branch format at
 
118
our latest branch format which adds support for tags.
 
119
 
 
120
Starting a new development format branch from one in an older format
 
121
--------------------------------------------------------------------
 
122
 
 
123
This can be done in one of several ways:
 
124
 
 
125
1. Create a new branch and pull into it
 
126
2. Create a standalone branch and upgrade its format
 
127
3. Create a knitpack shared repository and branch into it
 
128
 
 
129
Here are the commands for using the ``pull`` approach::
 
130
 
 
131
    bzr init --development my-new-branch
 
132
    cd my-new-branch
 
133
    bzr pull my-source-branch
 
134
 
 
135
Here are the commands for using the ``upgrade`` approach::
 
136
 
 
137
    bzr branch my-source-branch my-new-branch
 
138
    cd my-new-branch
 
139
    bzr upgrade --development .
 
140
 
 
141
Here are the commands for the shared repository approach::
 
142
 
 
143
  cd my-repo
 
144
  bzr init-repo --development .
 
145
  bzr branch my-source-branch my-new-branch
 
146
  cd my-new-branch
 
147
 
 
148
As a reminder, any of the above approaches can fail if the source branch
 
149
has inconsistent data within it and hasn't been reconciled yet. Please
 
150
be sure to check that before reporting problems.
 
151
 
 
152
Develoment formats for bzr-svn users
 
153
------------------------------------
 
154
 
 
155
If you are using ``bzr-svn`` or are testing the prototype subtree support,
 
156
you can still use and assist in testing the development formats. The
 
157
commands to use are identical to the ones given above except that the
 
158
name of the format to use is ``development-subtree``.
 
159
 
 
160
**WARNING**: Note that bzr only supports one-way conversion **to** the
 
161
subtree format ``development-subtree``. Once you are using
 
162
``development-subtree`` you cannot pull or merge back into a regular
 
163
format such as ``pack-0.92``, ``development`` etc.
 
164
 
 
165
The ``development-subtree`` format is required for the bzr-svn
 
166
plug-in but should otherwise not be used until the subtree feature is
 
167
complete within bzr.
 
168
 
 
169
Reporting problems
 
170
------------------
 
171
 
 
172
If you need any help or encounter any problems, please contact the developers
 
173
via the usual ways, i.e. chat to us on IRC or send a message to our mailing
 
174
list. See http://bazaar-vcs.org/BzrSupport for contact details.
 
175
 
 
176
 
 
177
Technical notes
 
178
===============
 
179
 
 
180
When to create a new development format
 
181
---------------------------------------
 
182
 
 
183
Whenever a code change will result in incorrect behaviour with existing
 
184
``development`` repositories. Changes in push/pull/init/commit/merge
 
185
have all been known to do this in the past.
 
186
 
 
187
How to create a new development format
 
188
--------------------------------------
 
189
 
 
190
1. Register two new formats with the next available sequence number.
 
191
   e.g. ``development1`` and ``development1-subtree``. (You can see the
 
192
   current development format for an example.
 
193
   These should:
 
194
 
 
195
   * Use your new development repository/branch/tree classes
 
196
   * Have really bare bones help - something like 'changes X to be Y
 
197
     see ...developers/development-repo.html'
 
198
   * Be hidden and experimental.
 
199
2. Change the repository class (or branch or tree) in the
 
200
   ``development`` and ``development-subtree`` formats to point to the
 
201
   new class you are creating.
 
202
3. Add a new development format (and tests!). Repository formats are in
 
203
   ``bzrlib.repofmt``. You probably want to reproduce the current
 
204
   development format from ``bzrlib.repofmt.pack_repo`` with just new
 
205
   disk format strings, ``_get_matching_bzrdir`` and help.
 
206
4. Register your development format with the various registries. At the
 
207
   moment you need to update:
 
208
 
 
209
    1. ``bzrlib/bzrdir.py`` to register the WT/Branch/Repository
 
210
       collection.
 
211
 
 
212
    2. ``bzrlib/workingtree.py``, ``bzrlib/branch.py``,
 
213
       ``bzrlib/repository.py``, each one maintains a direct list of
 
214
       their respective formats.
 
215
 
 
216
    3. For repositories, you also need to update the InterKnit1and2
 
217
       class. This is responsible for converting between rich-root and
 
218
       non-rich-root repositories.
 
219
 
 
220
    4. For repositories based on KnitPackRepository, you need to update
 
221
       ``bzrlib/tests/test_pack_repository.py`` to add the class to the
 
222
       tested permutations.
 
223
 
 
224
5. Alter any other things that do class based tests. The easiest way
 
225
   to find these is a grep for Development in bzrlib - and please
 
226
   refactor as you find these to reduce the relevance this step has,
 
227
   as it should not need to exist.
 
228
6. Now subclass/create from scratch/whatever the live object code you
 
229
   need to change to introduce your new format. Keep in mind that
 
230
   eventually it will become the default format, so please don't keep
 
231
   subclassing the last releases code, rather consider making the last
 
232
   releases code a subclass of your new code (if there is a lot in
 
233
   common) so that we can eventually remove that format once it becomes
 
234
   ancient (or relegate it to a plugin).
 
235
7. Once you have made the changes that required a new disk format, you
 
236
   should submit the resulting branch to be merged. Other changes - to
 
237
   take advantage of whatever new feature you have added - should be
 
238
   sent in separately, because the disk level changes are a contention
 
239
   point between multiple developers.
 
240
 
 
241
Format Details
 
242
==============
 
243
 
 
244
development
 
245
-----------
 
246
 
 
247
Not currently available, as our development formats are all rich root or
 
248
subtrees now.
 
249
 
 
250
development-rich-root
 
251
---------------------
 
252
 
 
253
Currently an alias for Development6Subtree
 
254
 
 
255
development-subtree
 
256
-------------------
 
257
 
 
258
Currently an alias for Development6Subtree
 
259
 
 
260
Development6RichRoot[Subtree]
 
261
-----------------------------
 
262
 
 
263
These formats use the new groupcompress delta compress and a CHK(Content
 
264
Hash Key) based inventory store which is much faster at incremental
 
265
operations than the prior XML based store.
 
266
*Note* Converting from a non-rich-root to a rich-root format is a
 
267
one-way upgrade, and you cannot merge back afterwards: using this format
 
268
for everyday use is likely to cause all developers of a project to
 
269
upgrade to a rich-root format themselves. This is fine, as bzr is moving
 
270
to make rich-root formats the default and to get all users to upgrade,
 
271
but we have not finalised the migration process, and until we do do not
 
272
recomment that casual users upgrade. Users of bzr-svn are already using
 
273
rich-root formats and can test with this with impunity.
 
274
 
 
275
 
 
276
..
 
277
   vim: tw=72 ft=rst expandtab