~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-21 17:22:25 UTC
  • mfrom: (5626.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110121172225-7mybq84k4ikcails
(vila) Merge 2.3 into trunk including bugfix for #701940 (Vincent
        Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
66
66
    )
67
67
from bzrlib.repofmt import pack_repo
68
68
from bzrlib.smart.client import _SmartClient
69
 
from bzrlib.store.versioned import WeaveStore
 
69
from bzrlib.store.versioned import VersionedFileStore
70
70
from bzrlib.transactions import WriteTransaction
71
71
from bzrlib.transport import (
72
72
    do_catching_redirections,
73
73
    get_transport,
74
74
    local,
75
75
    )
76
 
from bzrlib.weave import Weave
 
76
from bzrlib.weave import (
 
77
    WeaveFile,
 
78
    Weave,
 
79
    )
77
80
""")
78
81
 
79
82
from bzrlib.trace import (
927
930
        return format.initialize_on_transport(t)
928
931
 
929
932
 
930
 
 
931
933
class BzrDirHooks(hooks.Hooks):
932
934
    """Hooks for BzrDir operations."""
933
935
 
1027
1029
            tree.clone(result)
1028
1030
        return result
1029
1031
 
1030
 
    def create_branch(self, name=None):
 
1032
    def create_branch(self, name=None, repository=None):
1031
1033
        """See BzrDir.create_branch."""
 
1034
        if repository is not None:
 
1035
            raise NotImplementedError(
 
1036
                "create_branch(repository=<not None>) on %r" % (self,))
1032
1037
        return self._format.get_branch_format().initialize(self, name=name)
1033
1038
 
1034
1039
    def destroy_branch(self, name=None):
1264
1269
        """See BzrDir.can_convert_format()."""
1265
1270
        return True
1266
1271
 
1267
 
    def create_branch(self, name=None):
 
1272
    def create_branch(self, name=None, repository=None):
1268
1273
        """See BzrDir.create_branch."""
1269
 
        return self._format.get_branch_format().initialize(self, name=name)
 
1274
        return self._format.get_branch_format().initialize(self, name=name,
 
1275
                repository=repository)
1270
1276
 
1271
1277
    def destroy_branch(self, name=None):
1272
1278
        """See BzrDir.create_branch."""
1663
1669
        utf8_files = [('README',
1664
1670
                       "This is a Bazaar control directory.\n"
1665
1671
                       "Do not change any files in this directory.\n"
1666
 
                       "See http://bazaar-vcs.org/ for more information about Bazaar.\n"),
 
1672
                       "See http://bazaar.canonical.com/ for more information about Bazaar.\n"),
1667
1673
                      ('branch-format', self.get_format_string()),
1668
1674
                      ]
1669
1675
        # NB: no need to escape relative paths that are url safe.
2249
2255
            mode=self.bzrdir._get_file_mode())
2250
2256
 
2251
2257
    def _write_all_weaves(self):
2252
 
        controlweaves = WeaveStore(self.bzrdir.transport, prefixed=False)
 
2258
        controlweaves = VersionedFileStore(self.bzrdir.transport, prefixed=False,
 
2259
                                           versionedfile_class=WeaveFile)
2253
2260
        weave_transport = self.bzrdir.transport.clone('weaves')
2254
 
        weaves = WeaveStore(weave_transport, prefixed=False)
 
2261
        weaves = VersionedFileStore(weave_transport, prefixed=False,
 
2262
                            versionedfile_class=WeaveFile)
2255
2263
        transaction = WriteTransaction()
2256
2264
 
2257
2265
        try:
3254
3262
    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3255
3263
    )
3256
3264
# The following un-numbered 'development' formats should always just be aliases.
3257
 
register_metadir(controldir.format_registry, 'development-rich-root',
3258
 
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3259
 
    help='Current development format. Supports rich roots. Can convert data '
3260
 
        'to and from rich-root-pack (and anything compatible with '
3261
 
        'rich-root-pack) format repositories. Repositories and branches in '
3262
 
        'this format can only be read by bzr.dev. Please read '
3263
 
        'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3264
 
        'before use.',
3265
 
    branch_format='bzrlib.branch.BzrBranchFormat7',
3266
 
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3267
 
    experimental=True,
3268
 
    alias=True,
3269
 
    hidden=True,
3270
 
    )
3271
 
register_metadir(controldir.format_registry, 'development5-subtree',
3272
 
    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3273
 
    help='Development format, subtree variant. Can convert data to and '
3274
 
        'from pack-0.92-subtree (and anything compatible with '
3275
 
        'pack-0.92-subtree) format repositories. Repositories and branches in '
3276
 
        'this format can only be read by bzr.dev. Please read '
3277
 
        'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3278
 
        'before use.',
3279
 
    branch_format='bzrlib.branch.BzrBranchFormat7',
3280
 
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3281
 
    experimental=True,
3282
 
    hidden=True,
3283
 
    alias=False,
3284
 
    )
3285
 
 
3286
 
 
3287
3265
register_metadir(controldir.format_registry, 'development-subtree',
3288
3266
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2aSubtree',
3289
3267
    help='Current development format, subtree variant. Can convert data to and '
3300
3278
                 # This current non-alias status is simply because we did not introduce a
3301
3279
                 # chk based subtree format.
3302
3280
    )
 
3281
register_metadir(controldir.format_registry, 'development5-subtree',
 
3282
    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
 
3283
    help='Development format, subtree variant. Can convert data to and '
 
3284
        'from pack-0.92-subtree (and anything compatible with '
 
3285
        'pack-0.92-subtree) format repositories. Repositories and branches in '
 
3286
        'this format can only be read by bzr.dev. Please read '
 
3287
        'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
 
3288
        'before use.',
 
3289
    branch_format='bzrlib.branch.BzrBranchFormat7',
 
3290
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
 
3291
    experimental=True,
 
3292
    hidden=True,
 
3293
    alias=False,
 
3294
    )
3303
3295
 
3304
3296
# And the development formats above will have aliased one of the following:
3305
 
register_metadir(controldir.format_registry, 'development6-rich-root',
3306
 
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3307
 
    help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3308
 
        'Please read '
3309
 
        'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3310
 
        'before use.',
3311
 
    branch_format='bzrlib.branch.BzrBranchFormat7',
3312
 
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3313
 
    hidden=True,
3314
 
    experimental=True,
3315
 
    )
3316
 
 
3317
 
register_metadir(controldir.format_registry, 'development7-rich-root',
3318
 
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK2',
3319
 
    help='pack-1.9 with 255-way hashed CHK inv, bencode revision, group compress, '
3320
 
        'rich roots. Please read '
3321
 
        'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3322
 
        'before use.',
3323
 
    branch_format='bzrlib.branch.BzrBranchFormat7',
3324
 
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3325
 
    hidden=True,
3326
 
    experimental=True,
3327
 
    )
3328
 
 
 
3297
 
 
3298
# Finally, the current format.
3329
3299
register_metadir(controldir.format_registry, '2a',
3330
3300
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3331
3301
    help='First format for bzr 2.0 series.\n'