1978
class RepositoryFormatPack(MetaDirRepositoryFormat):
1979
"""Format logic for pack structured repositories.
1981
This repository format has:
1982
- a list of packs in pack-names
1983
- packs in packs/NAME.pack
1984
- indices in indices/NAME.{iix,six,tix,rix}
1985
- knit deltas in the packs, knit indices mapped to the indices.
1986
- thunk objects to support the knits programming API.
1987
- a format marker of its own
1988
- an optional 'shared-storage' flag
1989
- an optional 'no-working-trees' flag
1993
# Set this attribute in derived classes to control the repository class
1994
# created by open and initialize.
1995
repository_class = None
1996
# Set this attribute in derived classes to control the
1997
# _commit_builder_class that the repository objects will have passed to
1998
# their constructor.
1999
_commit_builder_class = None
2000
# Set this attribute in derived clases to control the _serializer that the
2001
# repository objects will have passed to their constructor.
2003
# External references are not supported in pack repositories yet.
2004
supports_external_lookups = False
2006
def initialize(self, a_bzrdir, shared=False):
2007
"""Create a pack based repository.
2009
:param a_bzrdir: bzrdir to contain the new repository; must already
2011
:param shared: If true the repository will be initialized as a shared
2014
mutter('creating repository in %s.', a_bzrdir.transport.base)
2015
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
2016
builder = GraphIndexBuilder()
2017
files = [('pack-names', builder.finish())]
2018
utf8_files = [('format', self.get_format_string())]
2020
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
2021
return self.open(a_bzrdir=a_bzrdir, _found=True)
2023
def open(self, a_bzrdir, _found=False, _override_transport=None):
2024
"""See RepositoryFormat.open().
2026
:param _override_transport: INTERNAL USE ONLY. Allows opening the
2027
repository at a slightly different url
2028
than normal. I.e. during 'upgrade'.
2031
format = RepositoryFormat.find_format(a_bzrdir)
2032
if _override_transport is not None:
2033
repo_transport = _override_transport
2035
repo_transport = a_bzrdir.get_repository_transport(None)
2036
control_files = lockable_files.LockableFiles(repo_transport,
2037
'lock', lockdir.LockDir)
2038
return self.repository_class(_format=self,
2040
control_files=control_files,
2041
_commit_builder_class=self._commit_builder_class,
2042
_serializer=self._serializer)
2045
class RepositoryFormatKnitPack1(RepositoryFormatPack):
2046
"""A no-subtrees parameterized Pack repository.
2048
This format was introduced in 0.92.
2051
repository_class = KnitPackRepository
2052
_commit_builder_class = PackCommitBuilder
2053
_serializer = xml5.serializer_v5
2055
def _get_matching_bzrdir(self):
2056
return bzrdir.format_registry.make_bzrdir('pack-0.92')
2058
def _ignore_setting_bzrdir(self, format):
2061
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
2063
def get_format_string(self):
2064
"""See RepositoryFormat.get_format_string()."""
2065
return "Bazaar pack repository format 1 (needs bzr 0.92)\n"
2067
def get_format_description(self):
2068
"""See RepositoryFormat.get_format_description()."""
2069
return "Packs containing knits without subtree support"
2071
def check_conversion_target(self, target_format):
2075
1973
class RepositoryFormatKnitPack3(RepositoryFormatPack):
2076
1974
"""A subtrees parameterized Pack repository.