1897
1904
transaction = self._transaction
1898
1905
self._transaction = None
1899
1906
transaction.finish()
1907
for repo in self._fallback_repositories:
1901
1910
self.control_files.unlock()
1911
for repo in self._fallback_repositories:
1915
class RepositoryFormatPack(MetaDirRepositoryFormat):
1916
"""Format logic for pack structured repositories.
1918
This repository format has:
1919
- a list of packs in pack-names
1920
- packs in packs/NAME.pack
1921
- indices in indices/NAME.{iix,six,tix,rix}
1922
- knit deltas in the packs, knit indices mapped to the indices.
1923
- thunk objects to support the knits programming API.
1924
- a format marker of its own
1925
- an optional 'shared-storage' flag
1926
- an optional 'no-working-trees' flag
1930
# Set this attribute in derived classes to control the repository class
1931
# created by open and initialize.
1932
repository_class = None
1933
# Set this attribute in derived classes to control the
1934
# _commit_builder_class that the repository objects will have passed to
1935
# their constructor.
1936
_commit_builder_class = None
1937
# Set this attribute in derived clases to control the _serializer that the
1938
# repository objects will have passed to their constructor.
1940
# External references are not supported in pack repositories yet.
1941
supports_external_lookups = False
1943
def initialize(self, a_bzrdir, shared=False):
1944
"""Create a pack based repository.
1946
:param a_bzrdir: bzrdir to contain the new repository; must already
1948
:param shared: If true the repository will be initialized as a shared
1951
mutter('creating repository in %s.', a_bzrdir.transport.base)
1952
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
1953
builder = GraphIndexBuilder()
1954
files = [('pack-names', builder.finish())]
1955
utf8_files = [('format', self.get_format_string())]
1957
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
1958
return self.open(a_bzrdir=a_bzrdir, _found=True)
1960
def open(self, a_bzrdir, _found=False, _override_transport=None):
1961
"""See RepositoryFormat.open().
1963
:param _override_transport: INTERNAL USE ONLY. Allows opening the
1964
repository at a slightly different url
1965
than normal. I.e. during 'upgrade'.
1968
format = RepositoryFormat.find_format(a_bzrdir)
1969
if _override_transport is not None:
1970
repo_transport = _override_transport
1972
repo_transport = a_bzrdir.get_repository_transport(None)
1973
control_files = lockable_files.LockableFiles(repo_transport,
1974
'lock', lockdir.LockDir)
1975
return self.repository_class(_format=self,
1977
control_files=control_files,
1978
_commit_builder_class=self._commit_builder_class,
1979
_serializer=self._serializer)
1982
class RepositoryFormatKnitPack1(RepositoryFormatPack):
1983
"""A no-subtrees parameterized Pack repository.
1985
This format was introduced in 0.92.
1988
repository_class = KnitPackRepository
1989
_commit_builder_class = PackCommitBuilder
1990
_serializer = xml5.serializer_v5
1992
def _get_matching_bzrdir(self):
1993
return bzrdir.format_registry.make_bzrdir('pack-0.92')
1995
def _ignore_setting_bzrdir(self, format):
1998
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2000
def get_format_string(self):
2001
"""See RepositoryFormat.get_format_string()."""
2002
return "Bazaar pack repository format 1 (needs bzr 0.92)\n"
2004
def get_format_description(self):
2005
"""See RepositoryFormat.get_format_description()."""
2006
return "Packs containing knits without subtree support"
2008
def check_conversion_target(self, target_format):
1904
2012
class RepositoryFormatPack(MetaDirRepositoryFormat):
2154
2262
"pack-0.92-subtree\n")
2265
class RepositoryFormatPackDevelopment1(RepositoryFormatPackDevelopment0):
2266
"""A no-subtrees development repository.
2268
This format should be retained until the second release after bzr 1.5.
2270
Supports external lookups, which results in non-truncated ghosts after
2271
reconcile compared to pack-0.92 formats.
2274
supports_external_lookups = True
2276
def _get_matching_bzrdir(self):
2277
return bzrdir.format_registry.make_bzrdir('development1')
2279
def _ignore_setting_bzrdir(self, format):
2282
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2284
def get_format_string(self):
2285
"""See RepositoryFormat.get_format_string()."""
2286
return "Bazaar development format 1 (needs bzr.dev from before 1.6)\n"
2288
def get_format_description(self):
2289
"""See RepositoryFormat.get_format_description()."""
2290
return ("Development repository format, currently the same as "
2291
"pack-0.92 with external reference support.\n")
2293
def check_conversion_target(self, target_format):
2297
class RepositoryFormatPackDevelopment1Subtree(RepositoryFormatPackDevelopment0Subtree):
2298
"""A subtrees development repository.
2300
This format should be retained until the second release after bzr 1.5.
2302
Supports external lookups, which results in non-truncated ghosts after
2303
reconcile compared to pack-0.92 formats.
2306
supports_external_lookups = True
2308
def _get_matching_bzrdir(self):
2309
return bzrdir.format_registry.make_bzrdir(
2310
'development1-subtree')
2312
def _ignore_setting_bzrdir(self, format):
2315
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2317
def check_conversion_target(self, target_format):
2318
if not target_format.rich_root_data:
2319
raise errors.BadConversionTarget(
2320
'Does not support rich root data.', target_format)
2321
if not getattr(target_format, 'supports_tree_reference', False):
2322
raise errors.BadConversionTarget(
2323
'Does not support nested trees', target_format)
2325
def get_format_string(self):
2326
"""See RepositoryFormat.get_format_string()."""
2327
return ("Bazaar development format 1 with subtree support "
2328
"(needs bzr.dev from before 1.6)\n")
2330
def get_format_description(self):
2331
"""See RepositoryFormat.get_format_description()."""
2332
return ("Development repository format, currently the same as "
2333
"pack-0.92-subtree with external reference support.\n")