224
214
'signature': ('.six', 3),
227
def __init__(self, upload_transport, index_transport, pack_transport,
228
upload_suffix='', file_mode=None):
217
def __init__(self, pack_collection, upload_suffix='', file_mode=None):
229
218
"""Create a NewPack instance.
231
:param upload_transport: A writable transport for the pack to be
232
incrementally uploaded to.
233
:param index_transport: A writable transport for the pack's indices to
234
be written to when the pack is finished.
235
:param pack_transport: A writable transport for the pack to be renamed
236
to when the upload is complete. This *must* be the same as
237
upload_transport.clone('../packs').
220
:param pack_collection: A PackCollection into which this is being inserted.
238
221
:param upload_suffix: An optional suffix to be given to any temporary
239
222
files created during the pack creation. e.g '.autopack'
240
:param file_mode: An optional file mode to create the new files with.
223
:param file_mode: Unix permissions for newly created file.
242
225
# The relative locations of the packs are constrained, but all are
243
226
# passed in because the caller has them, so as to avoid object churn.
227
index_builder_class = pack_collection._index_builder_class
244
228
Pack.__init__(self,
245
229
# Revisions: parents list, no text compression.
246
InMemoryGraphIndex(reference_lists=1),
230
index_builder_class(reference_lists=1),
247
231
# Inventory: We want to map compression only, but currently the
248
232
# knit code hasn't been updated enough to understand that, so we
249
233
# have a regular 2-list index giving parents and compression
251
InMemoryGraphIndex(reference_lists=2),
235
index_builder_class(reference_lists=2),
252
236
# Texts: compression and per file graph, for all fileids - so two
253
237
# reference lists and two elements in the key tuple.
254
InMemoryGraphIndex(reference_lists=2, key_elements=2),
238
index_builder_class(reference_lists=2, key_elements=2),
255
239
# Signatures: Just blobs to store, no compression, no parents
257
InMemoryGraphIndex(reference_lists=0),
241
index_builder_class(reference_lists=0),
243
self._pack_collection = pack_collection
244
# When we make readonly indices, we need this.
245
self.index_class = pack_collection._index_class
259
246
# where should the new pack be opened
260
self.upload_transport = upload_transport
247
self.upload_transport = pack_collection._upload_transport
261
248
# where are indices written out to
262
self.index_transport = index_transport
249
self.index_transport = pack_collection._index_transport
263
250
# where is the pack renamed to when it is finished?
264
self.pack_transport = pack_transport
251
self.pack_transport = pack_collection._pack_transport
265
252
# What file mode to upload the pack and indices with.
266
253
self._file_mode = file_mode
267
254
# tracks the content written to the .pack file.
268
self._hash = md5.new()
255
self._hash = osutils.md5()
269
256
# a four-tuple with the length in bytes of the indices, once the pack
270
257
# is finalised. (rev, inv, text, sigs)
271
258
self.index_sizes = None
599
652
def open_pack(self):
600
653
"""Open a pack for the pack we are creating."""
601
return NewPack(self._pack_collection._upload_transport,
602
self._pack_collection._index_transport,
603
self._pack_collection._pack_transport, upload_suffix=self.suffix,
604
file_mode=self._pack_collection.repo.bzrdir._get_file_mode())
654
return NewPack(self._pack_collection, upload_suffix=self.suffix,
655
file_mode=self._pack_collection.repo.bzrdir._get_file_mode())
657
def _update_pack_order(self, entries, index_to_pack_map):
658
"""Determine how we want our packs to be ordered.
660
This changes the sort order of the self.packs list so that packs unused
661
by 'entries' will be at the end of the list, so that future requests
662
can avoid probing them. Used packs will be at the front of the
663
self.packs list, in the order of their first use in 'entries'.
665
:param entries: A list of (index, ...) tuples
666
:param index_to_pack_map: A mapping from index objects to pack objects.
670
for entry in entries:
672
if index not in seen_indexes:
673
packs.append(index_to_pack_map[index])
674
seen_indexes.add(index)
675
if len(packs) == len(self.packs):
676
if 'pack' in debug.debug_flags:
677
mutter('Not changing pack list, all packs used.')
679
seen_packs = set(packs)
680
for pack in self.packs:
681
if pack not in seen_packs:
684
if 'pack' in debug.debug_flags:
685
old_names = [p.access_tuple()[1] for p in self.packs]
686
new_names = [p.access_tuple()[1] for p in packs]
687
mutter('Reordering packs\nfrom: %s\n to: %s',
688
old_names, new_names)
606
691
def _copy_revision_texts(self):
607
692
"""Copy revision data to the new pack."""
1477
1582
self._packs_by_name = {}
1478
1583
self._packs_at_load = None
1480
def _make_index_map(self, index_suffix):
1481
"""Return information on existing indices.
1483
:param suffix: Index suffix added to pack name.
1485
:returns: (pack_map, indices) where indices is a list of GraphIndex
1486
objects, and pack_map is a mapping from those objects to the
1487
pack tuple they describe.
1489
# TODO: stop using this; it creates new indices unnecessarily.
1490
self.ensure_loaded()
1491
suffix_map = {'.rix': 'revision_index',
1492
'.six': 'signature_index',
1493
'.iix': 'inventory_index',
1494
'.tix': 'text_index',
1496
return self._packs_list_to_pack_map_and_index_list(self.all_packs(),
1497
suffix_map[index_suffix])
1499
def _packs_list_to_pack_map_and_index_list(self, packs, index_attribute):
1500
"""Convert a list of packs to an index pack map and index list.
1502
:param packs: The packs list to process.
1503
:param index_attribute: The attribute that the desired index is found
1505
:return: A tuple (map, list) where map contains the dict from
1506
index:pack_tuple, and lsit contains the indices in the same order
1512
index = getattr(pack, index_attribute)
1513
indices.append(index)
1514
pack_map[index] = (pack.pack_transport, pack.file_name())
1515
return pack_map, indices
1517
def _index_contents(self, pack_map, key_filter=None):
1518
"""Get an iterable of the index contents from a pack_map.
1520
:param pack_map: A map from indices to pack details.
1521
:param key_filter: An optional filter to limit the
1524
indices = [index for index in pack_map.iterkeys()]
1525
all_index = CombinedGraphIndex(indices)
1526
if key_filter is None:
1527
return all_index.iter_all_entries()
1529
return all_index.iter_entries(key_filter)
1531
1585
def _unlock_names(self):
1532
1586
"""Release the mutex around the pack-names index."""
1533
1587
self.repo.control_files.unlock()
1535
def _save_pack_names(self, clear_obsolete_packs=False):
1536
"""Save the list of packs.
1538
This will take out the mutex around the pack names list for the
1539
duration of the method call. If concurrent updates have been made, a
1540
three-way merge between the current list and the current in memory list
1543
:param clear_obsolete_packs: If True, clear out the contents of the
1544
obsolete_packs directory.
1548
builder = GraphIndexBuilder()
1549
# load the disk nodes across
1551
for index, key, value in self._iter_disk_pack_index():
1552
disk_nodes.add((key, value))
1553
# do a two-way diff against our original content
1554
current_nodes = set()
1555
for name, sizes in self._names.iteritems():
1557
((name, ), ' '.join(str(size) for size in sizes)))
1558
deleted_nodes = self._packs_at_load - current_nodes
1559
new_nodes = current_nodes - self._packs_at_load
1560
disk_nodes.difference_update(deleted_nodes)
1561
disk_nodes.update(new_nodes)
1562
# TODO: handle same-name, index-size-changes here -
1563
# e.g. use the value from disk, not ours, *unless* we're the one
1565
for key, value in disk_nodes:
1566
builder.add_node(key, value)
1567
self.transport.put_file('pack-names', builder.finish(),
1568
mode=self.repo.bzrdir._get_file_mode())
1569
# move the baseline forward
1570
self._packs_at_load = disk_nodes
1571
if clear_obsolete_packs:
1572
self._clear_obsolete_packs()
1574
self._unlock_names()
1575
# synchronise the memory packs list with what we just wrote:
1589
def _diff_pack_names(self):
1590
"""Read the pack names from disk, and compare it to the one in memory.
1592
:return: (disk_nodes, deleted_nodes, new_nodes)
1593
disk_nodes The final set of nodes that should be referenced
1594
deleted_nodes Nodes which have been removed from when we started
1595
new_nodes Nodes that are newly introduced
1597
# load the disk nodes across
1599
for index, key, value in self._iter_disk_pack_index():
1600
disk_nodes.add((key, value))
1602
# do a two-way diff against our original content
1603
current_nodes = set()
1604
for name, sizes in self._names.iteritems():
1606
((name, ), ' '.join(str(size) for size in sizes)))
1608
# Packs no longer present in the repository, which were present when we
1609
# locked the repository
1610
deleted_nodes = self._packs_at_load - current_nodes
1611
# Packs which this process is adding
1612
new_nodes = current_nodes - self._packs_at_load
1614
# Update the disk_nodes set to include the ones we are adding, and
1615
# remove the ones which were removed by someone else
1616
disk_nodes.difference_update(deleted_nodes)
1617
disk_nodes.update(new_nodes)
1619
return disk_nodes, deleted_nodes, new_nodes
1621
def _syncronize_pack_names_from_disk_nodes(self, disk_nodes):
1622
"""Given the correct set of pack files, update our saved info.
1624
:return: (removed, added, modified)
1625
removed pack names removed from self._names
1626
added pack names added to self._names
1627
modified pack names that had changed value
1632
## self._packs_at_load = disk_nodes
1576
1633
new_names = dict(disk_nodes)
1577
1634
# drop no longer present nodes
1578
1635
for pack in self.all_packs():
1579
1636
if (pack.name,) not in new_names:
1637
removed.append(pack.name)
1580
1638
self._remove_pack_from_memory(pack)
1581
1639
# add new nodes/refresh existing ones
1582
1640
for key, value in disk_nodes:
1596
1654
self._remove_pack_from_memory(self.get_pack_by_name(name))
1597
1655
self._names[name] = sizes
1598
1656
self.get_pack_by_name(name)
1657
modified.append(name)
1601
1660
self._names[name] = sizes
1602
1661
self.get_pack_by_name(name)
1663
return removed, added, modified
1665
def _save_pack_names(self, clear_obsolete_packs=False):
1666
"""Save the list of packs.
1668
This will take out the mutex around the pack names list for the
1669
duration of the method call. If concurrent updates have been made, a
1670
three-way merge between the current list and the current in memory list
1673
:param clear_obsolete_packs: If True, clear out the contents of the
1674
obsolete_packs directory.
1678
builder = self._index_builder_class()
1679
disk_nodes, deleted_nodes, new_nodes = self._diff_pack_names()
1680
# TODO: handle same-name, index-size-changes here -
1681
# e.g. use the value from disk, not ours, *unless* we're the one
1683
for key, value in disk_nodes:
1684
builder.add_node(key, value)
1685
self.transport.put_file('pack-names', builder.finish(),
1686
mode=self.repo.bzrdir._get_file_mode())
1687
# move the baseline forward
1688
self._packs_at_load = disk_nodes
1689
if clear_obsolete_packs:
1690
self._clear_obsolete_packs()
1692
self._unlock_names()
1693
# synchronise the memory packs list with what we just wrote:
1694
self._syncronize_pack_names_from_disk_nodes(disk_nodes)
1696
def reload_pack_names(self):
1697
"""Sync our pack listing with what is present in the repository.
1699
This should be called when we find out that something we thought was
1700
present is now missing. This happens when another process re-packs the
1703
# This is functionally similar to _save_pack_names, but we don't write
1704
# out the new value.
1705
disk_nodes, _, _ = self._diff_pack_names()
1706
self._packs_at_load = disk_nodes
1708
modified) = self._syncronize_pack_names_from_disk_nodes(disk_nodes)
1709
if removed or added or modified:
1604
1713
def _clear_obsolete_packs(self):
1605
1714
"""Delete everything from the obsolete-packs directory.
1910
2032
_serializer = None
1911
2033
# External references are not supported in pack repositories yet.
1912
2034
supports_external_lookups = False
1914
def initialize(self, a_bzrdir, shared=False):
1915
"""Create a pack based repository.
1917
:param a_bzrdir: bzrdir to contain the new repository; must already
1919
:param shared: If true the repository will be initialized as a shared
1922
mutter('creating repository in %s.', a_bzrdir.transport.base)
1923
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
1924
builder = GraphIndexBuilder()
1925
files = [('pack-names', builder.finish())]
1926
utf8_files = [('format', self.get_format_string())]
1928
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
1929
return self.open(a_bzrdir=a_bzrdir, _found=True)
1931
def open(self, a_bzrdir, _found=False, _override_transport=None):
1932
"""See RepositoryFormat.open().
1934
:param _override_transport: INTERNAL USE ONLY. Allows opening the
1935
repository at a slightly different url
1936
than normal. I.e. during 'upgrade'.
1939
format = RepositoryFormat.find_format(a_bzrdir)
1940
if _override_transport is not None:
1941
repo_transport = _override_transport
1943
repo_transport = a_bzrdir.get_repository_transport(None)
1944
control_files = lockable_files.LockableFiles(repo_transport,
1945
'lock', lockdir.LockDir)
1946
return self.repository_class(_format=self,
1948
control_files=control_files,
1949
_commit_builder_class=self._commit_builder_class,
1950
_serializer=self._serializer)
1953
class RepositoryFormatKnitPack1(RepositoryFormatPack):
1954
"""A no-subtrees parameterized Pack repository.
1956
This format was introduced in 0.92.
1959
repository_class = KnitPackRepository
1960
_commit_builder_class = PackCommitBuilder
1961
_serializer = xml5.serializer_v5
1963
def _get_matching_bzrdir(self):
1964
return bzrdir.format_registry.make_bzrdir('pack-0.92')
1966
def _ignore_setting_bzrdir(self, format):
1969
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1971
def get_format_string(self):
1972
"""See RepositoryFormat.get_format_string()."""
1973
return "Bazaar pack repository format 1 (needs bzr 0.92)\n"
1975
def get_format_description(self):
1976
"""See RepositoryFormat.get_format_description()."""
1977
return "Packs containing knits without subtree support"
1979
def check_conversion_target(self, target_format):
1983
class RepositoryFormatPack(MetaDirRepositoryFormat):
1984
"""Format logic for pack structured repositories.
1986
This repository format has:
1987
- a list of packs in pack-names
1988
- packs in packs/NAME.pack
1989
- indices in indices/NAME.{iix,six,tix,rix}
1990
- knit deltas in the packs, knit indices mapped to the indices.
1991
- thunk objects to support the knits programming API.
1992
- a format marker of its own
1993
- an optional 'shared-storage' flag
1994
- an optional 'no-working-trees' flag
1998
# Set this attribute in derived classes to control the repository class
1999
# created by open and initialize.
2000
repository_class = None
2001
# Set this attribute in derived classes to control the
2002
# _commit_builder_class that the repository objects will have passed to
2003
# their constructor.
2004
_commit_builder_class = None
2005
# Set this attribute in derived clases to control the _serializer that the
2006
# repository objects will have passed to their constructor.
2008
# External references are not supported in pack repositories yet.
2009
supports_external_lookups = False
2011
def initialize(self, a_bzrdir, shared=False):
2012
"""Create a pack based repository.
2014
:param a_bzrdir: bzrdir to contain the new repository; must already
2016
:param shared: If true the repository will be initialized as a shared
2019
mutter('creating repository in %s.', a_bzrdir.transport.base)
2020
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
2021
builder = GraphIndexBuilder()
2022
files = [('pack-names', builder.finish())]
2023
utf8_files = [('format', self.get_format_string())]
2025
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
2026
return self.open(a_bzrdir=a_bzrdir, _found=True)
2028
def open(self, a_bzrdir, _found=False, _override_transport=None):
2029
"""See RepositoryFormat.open().
2031
:param _override_transport: INTERNAL USE ONLY. Allows opening the
2032
repository at a slightly different url
2033
than normal. I.e. during 'upgrade'.
2036
format = RepositoryFormat.find_format(a_bzrdir)
2037
if _override_transport is not None:
2038
repo_transport = _override_transport
2040
repo_transport = a_bzrdir.get_repository_transport(None)
2041
control_files = lockable_files.LockableFiles(repo_transport,
2042
'lock', lockdir.LockDir)
2043
return self.repository_class(_format=self,
2045
control_files=control_files,
2046
_commit_builder_class=self._commit_builder_class,
2047
_serializer=self._serializer)
2050
class RepositoryFormatKnitPack1(RepositoryFormatPack):
2051
"""A no-subtrees parameterized Pack repository.
2053
This format was introduced in 0.92.
2056
repository_class = KnitPackRepository
2057
_commit_builder_class = PackCommitBuilder
2058
_serializer = xml5.serializer_v5
2035
# What index classes to use
2036
index_builder_class = None
2039
def initialize(self, a_bzrdir, shared=False):
2040
"""Create a pack based repository.
2042
:param a_bzrdir: bzrdir to contain the new repository; must already
2044
:param shared: If true the repository will be initialized as a shared
2047
mutter('creating repository in %s.', a_bzrdir.transport.base)
2048
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
2049
builder = self.index_builder_class()
2050
files = [('pack-names', builder.finish())]
2051
utf8_files = [('format', self.get_format_string())]
2053
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
2054
return self.open(a_bzrdir=a_bzrdir, _found=True)
2056
def open(self, a_bzrdir, _found=False, _override_transport=None):
2057
"""See RepositoryFormat.open().
2059
:param _override_transport: INTERNAL USE ONLY. Allows opening the
2060
repository at a slightly different url
2061
than normal. I.e. during 'upgrade'.
2064
format = RepositoryFormat.find_format(a_bzrdir)
2065
if _override_transport is not None:
2066
repo_transport = _override_transport
2068
repo_transport = a_bzrdir.get_repository_transport(None)
2069
control_files = lockable_files.LockableFiles(repo_transport,
2070
'lock', lockdir.LockDir)
2071
return self.repository_class(_format=self,
2073
control_files=control_files,
2074
_commit_builder_class=self._commit_builder_class,
2075
_serializer=self._serializer)
2078
class RepositoryFormatKnitPack1(RepositoryFormatPack):
2079
"""A no-subtrees parameterized Pack repository.
2081
This format was introduced in 0.92.
2084
repository_class = KnitPackRepository
2085
_commit_builder_class = PackCommitBuilder
2087
def _serializer(self):
2088
return xml5.serializer_v5
2089
# What index classes to use
2090
index_builder_class = InMemoryGraphIndex
2091
index_class = GraphIndex
2060
2093
def _get_matching_bzrdir(self):
2061
2094
return bzrdir.format_registry.make_bzrdir('pack-0.92')
2187
2236
def get_format_description(self):
2188
2237
"""See RepositoryFormat.get_format_description()."""
2238
return "Packs 5 (adds stacking support, requires bzr 1.6)"
2191
2240
def check_conversion_target(self, target_format):
2195
2244
class RepositoryFormatKnitPack5RichRoot(RepositoryFormatPack):
2196
"""A repository with subtrees and external references.
2245
"""A repository with rich roots and stacking.
2247
New in release 1.6.1.
2249
Supports stacking on other repositories, allowing data to be accessed
2250
without being stored locally.
2253
repository_class = KnitPackRepository
2254
_commit_builder_class = PackRootCommitBuilder
2255
rich_root_data = True
2256
supports_tree_reference = False # no subtrees
2257
supports_external_lookups = True
2258
# What index classes to use
2259
index_builder_class = InMemoryGraphIndex
2260
index_class = GraphIndex
2263
def _serializer(self):
2264
return xml6.serializer_v6
2266
def _get_matching_bzrdir(self):
2267
return bzrdir.format_registry.make_bzrdir(
2270
def _ignore_setting_bzrdir(self, format):
2273
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2275
def check_conversion_target(self, target_format):
2276
if not target_format.rich_root_data:
2277
raise errors.BadConversionTarget(
2278
'Does not support rich root data.', target_format)
2280
def get_format_string(self):
2281
"""See RepositoryFormat.get_format_string()."""
2282
return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6.1)\n"
2284
def get_format_description(self):
2285
return "Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)"
2288
class RepositoryFormatKnitPack5RichRootBroken(RepositoryFormatPack):
2289
"""A repository with rich roots and external references.
2198
2291
New in release 1.6.
2200
2293
Supports external lookups, which results in non-truncated ghosts after
2201
2294
reconcile compared to pack-0.92 formats.
2296
This format was deprecated because the serializer it uses accidentally
2297
supported subtrees, when the format was not intended to. This meant that
2298
someone could accidentally fetch from an incorrect repository.
2204
2301
repository_class = KnitPackRepository
2205
2302
_commit_builder_class = PackRootCommitBuilder
2206
2303
rich_root_data = True
2207
2304
supports_tree_reference = False # no subtrees
2208
_serializer = xml7.serializer_v7
2210
2306
supports_external_lookups = True
2307
# What index classes to use
2308
index_builder_class = InMemoryGraphIndex
2309
index_class = GraphIndex
2312
def _serializer(self):
2313
return xml7.serializer_v7
2212
2315
def _get_matching_bzrdir(self):
2213
return bzrdir.format_registry.make_bzrdir(
2214
'development1-subtree')
2316
matching = bzrdir.format_registry.make_bzrdir(
2318
matching.repository_format = self
2216
2321
def _ignore_setting_bzrdir(self, format):
2222
2327
if not target_format.rich_root_data:
2223
2328
raise errors.BadConversionTarget(
2224
2329
'Does not support rich root data.', target_format)
2226
2331
def get_format_string(self):
2227
2332
"""See RepositoryFormat.get_format_string()."""
2228
2333
return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6)\n"
2230
2335
def get_format_description(self):
2336
return ("Packs 5 rich-root (adds stacking support, requires bzr 1.6)"
2340
class RepositoryFormatKnitPack6(RepositoryFormatPack):
2341
"""A repository with stacking and btree indexes,
2342
without rich roots or subtrees.
2344
This is equivalent to pack-1.6 with B+Tree indices.
2347
repository_class = KnitPackRepository
2348
_commit_builder_class = PackCommitBuilder
2349
supports_external_lookups = True
2350
# What index classes to use
2351
index_builder_class = BTreeBuilder
2352
index_class = BTreeGraphIndex
2355
def _serializer(self):
2356
return xml5.serializer_v5
2358
def _get_matching_bzrdir(self):
2359
return bzrdir.format_registry.make_bzrdir('1.9')
2361
def _ignore_setting_bzrdir(self, format):
2364
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2366
def get_format_string(self):
2367
"""See RepositoryFormat.get_format_string()."""
2368
return "Bazaar RepositoryFormatKnitPack6 (bzr 1.9)\n"
2370
def get_format_description(self):
2231
2371
"""See RepositoryFormat.get_format_description()."""
2235
class RepositoryFormatPackDevelopment0(RepositoryFormatPack):
2372
return "Packs 6 (uses btree indexes, requires bzr 1.9)"
2374
def check_conversion_target(self, target_format):
2378
class RepositoryFormatKnitPack6RichRoot(RepositoryFormatPack):
2379
"""A repository with rich roots, no subtrees, stacking and btree indexes.
2381
1.6-rich-root with B+Tree indices.
2384
repository_class = KnitPackRepository
2385
_commit_builder_class = PackRootCommitBuilder
2386
rich_root_data = True
2387
supports_tree_reference = False # no subtrees
2388
supports_external_lookups = True
2389
# What index classes to use
2390
index_builder_class = BTreeBuilder
2391
index_class = BTreeGraphIndex
2394
def _serializer(self):
2395
return xml6.serializer_v6
2397
def _get_matching_bzrdir(self):
2398
return bzrdir.format_registry.make_bzrdir(
2401
def _ignore_setting_bzrdir(self, format):
2404
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2406
def check_conversion_target(self, target_format):
2407
if not target_format.rich_root_data:
2408
raise errors.BadConversionTarget(
2409
'Does not support rich root data.', target_format)
2411
def get_format_string(self):
2412
"""See RepositoryFormat.get_format_string()."""
2413
return "Bazaar RepositoryFormatKnitPack6RichRoot (bzr 1.9)\n"
2415
def get_format_description(self):
2416
return "Packs 6 rich-root (uses btree indexes, requires bzr 1.9)"
2419
class RepositoryFormatPackDevelopment2(RepositoryFormatPack):
2236
2420
"""A no-subtrees development repository.
2238
This format should be retained until the second release after bzr 1.0.
2422
This format should be retained until the second release after bzr 1.7.
2240
No changes to the disk behaviour from pack-0.92.
2424
This is pack-1.6.1 with B+Tree indices.
2243
2427
repository_class = KnitPackRepository
2244
2428
_commit_builder_class = PackCommitBuilder
2245
_serializer = xml5.serializer_v5
2429
supports_external_lookups = True
2430
# What index classes to use
2431
index_builder_class = BTreeBuilder
2432
index_class = BTreeGraphIndex
2435
def _serializer(self):
2436
return xml5.serializer_v5
2247
2438
def _get_matching_bzrdir(self):
2248
return bzrdir.format_registry.make_bzrdir('development0')
2439
return bzrdir.format_registry.make_bzrdir('development2')
2250
2441
def _ignore_setting_bzrdir(self, format):
2255
2446
def get_format_string(self):
2256
2447
"""See RepositoryFormat.get_format_string()."""
2257
return "Bazaar development format 0 (needs bzr.dev from before 1.3)\n"
2448
return "Bazaar development format 2 (needs bzr.dev from before 1.8)\n"
2259
2450
def get_format_description(self):
2260
2451
"""See RepositoryFormat.get_format_description()."""
2261
2452
return ("Development repository format, currently the same as "
2453
"1.6.1 with B+Trees.\n")
2264
2455
def check_conversion_target(self, target_format):
2268
class RepositoryFormatPackDevelopment0Subtree(RepositoryFormatPack):
2459
class RepositoryFormatPackDevelopment2Subtree(RepositoryFormatPack):
2269
2460
"""A subtrees development repository.
2271
This format should be retained until the second release after bzr 1.0.
2462
This format should be retained until the second release after bzr 1.7.
2273
No changes to the disk behaviour from pack-0.92-subtree.
2464
1.6.1-subtree[as it might have been] with B+Tree indices.
2276
2467
repository_class = KnitPackRepository
2277
2468
_commit_builder_class = PackRootCommitBuilder
2278
2469
rich_root_data = True
2279
2470
supports_tree_reference = True
2280
_serializer = xml7.serializer_v7
2282
def _get_matching_bzrdir(self):
2283
return bzrdir.format_registry.make_bzrdir(
2284
'development0-subtree')
2286
def _ignore_setting_bzrdir(self, format):
2289
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2291
def check_conversion_target(self, target_format):
2292
if not target_format.rich_root_data:
2293
raise errors.BadConversionTarget(
2294
'Does not support rich root data.', target_format)
2295
if not getattr(target_format, 'supports_tree_reference', False):
2296
raise errors.BadConversionTarget(
2297
'Does not support nested trees', target_format)
2299
def get_format_string(self):
2300
"""See RepositoryFormat.get_format_string()."""
2301
return ("Bazaar development format 0 with subtree support "
2302
"(needs bzr.dev from before 1.3)\n")
2304
def get_format_description(self):
2305
"""See RepositoryFormat.get_format_description()."""
2306
return ("Development repository format, currently the same as "
2307
"pack-0.92-subtree\n")
2310
class RepositoryFormatPackDevelopment1(RepositoryFormatPackDevelopment0):
2311
"""A no-subtrees development repository.
2313
This format should be retained until the second release after bzr 1.5.
2315
Supports external lookups, which results in non-truncated ghosts after
2316
reconcile compared to pack-0.92 formats.
2319
supports_external_lookups = True
2321
def _get_matching_bzrdir(self):
2322
return bzrdir.format_registry.make_bzrdir('development1')
2324
def _ignore_setting_bzrdir(self, format):
2327
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2329
def get_format_string(self):
2330
"""See RepositoryFormat.get_format_string()."""
2331
return "Bazaar development format 1 (needs bzr.dev from before 1.6)\n"
2333
def get_format_description(self):
2334
"""See RepositoryFormat.get_format_description()."""
2335
return ("Development repository format, currently the same as "
2336
"pack-0.92 with external reference support.\n")
2338
def check_conversion_target(self, target_format):
2342
class RepositoryFormatPackDevelopment1Subtree(RepositoryFormatPackDevelopment0Subtree):
2343
"""A subtrees development repository.
2345
This format should be retained until the second release after bzr 1.5.
2347
Supports external lookups, which results in non-truncated ghosts after
2348
reconcile compared to pack-0.92 formats.
2351
supports_external_lookups = True
2353
def _get_matching_bzrdir(self):
2354
return bzrdir.format_registry.make_bzrdir(
2355
'development1-subtree')
2357
def _ignore_setting_bzrdir(self, format):
2360
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2362
def check_conversion_target(self, target_format):
2363
if not target_format.rich_root_data:
2364
raise errors.BadConversionTarget(
2365
'Does not support rich root data.', target_format)
2366
if not getattr(target_format, 'supports_tree_reference', False):
2367
raise errors.BadConversionTarget(
2368
'Does not support nested trees', target_format)
2370
def get_format_string(self):
2371
"""See RepositoryFormat.get_format_string()."""
2372
return ("Bazaar development format 1 with subtree support "
2373
"(needs bzr.dev from before 1.6)\n")
2375
def get_format_description(self):
2376
"""See RepositoryFormat.get_format_description()."""
2377
return ("Development repository format, currently the same as "
2378
"pack-0.92-subtree with external reference support.\n")
2471
supports_external_lookups = True
2472
# What index classes to use
2473
index_builder_class = BTreeBuilder
2474
index_class = BTreeGraphIndex
2477
def _serializer(self):
2478
return xml7.serializer_v7
2480
def _get_matching_bzrdir(self):
2481
return bzrdir.format_registry.make_bzrdir(
2482
'development2-subtree')
2484
def _ignore_setting_bzrdir(self, format):
2487
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2489
def check_conversion_target(self, target_format):
2490
if not target_format.rich_root_data:
2491
raise errors.BadConversionTarget(
2492
'Does not support rich root data.', target_format)
2493
if not getattr(target_format, 'supports_tree_reference', False):
2494
raise errors.BadConversionTarget(
2495
'Does not support nested trees', target_format)
2497
def get_format_string(self):
2498
"""See RepositoryFormat.get_format_string()."""
2499
return ("Bazaar development format 2 with subtree support "
2500
"(needs bzr.dev from before 1.8)\n")
2502
def get_format_description(self):
2503
"""See RepositoryFormat.get_format_description()."""
2504
return ("Development repository format, currently the same as "
2505
"1.6.1-subtree with B+Tree indices.\n")