~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Martin Pool
  • Date: 2009-07-01 07:22:00 UTC
  • mto: This revision was merged to the branch mainline in revision 4502.
  • Revision ID: mbp@sourcefrog.net-20090701072200-hh21x94g1g11dll7
ReadVFile copes if readv result isn't an iter; also better errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    do_catching_redirections,
71
71
    get_transport,
72
72
    local,
 
73
    remote as remote_transport,
73
74
    )
74
75
from bzrlib.weave import Weave
75
76
""")
77
78
from bzrlib.trace import (
78
79
    mutter,
79
80
    note,
80
 
    warning,
81
81
    )
82
82
 
83
83
from bzrlib import (
129
129
        return True
130
130
 
131
131
    def check_conversion_target(self, target_format):
132
 
        """Check that a bzrdir as a whole can be converted to a new format."""
133
 
        # The only current restriction is that the repository content can be 
134
 
        # fetched compatibly with the target.
135
132
        target_repo_format = target_format.repository_format
136
 
        try:
137
 
            self.open_repository()._format.check_conversion_target(
138
 
                target_repo_format)
139
 
        except errors.NoRepositoryPresent:
140
 
            # No repo, no problem.
141
 
            pass
 
133
        source_repo_format = self._format.repository_format
 
134
        source_repo_format.check_conversion_target(target_repo_format)
142
135
 
143
136
    @staticmethod
144
137
    def _check_supported(format, allow_unsupported,
1241
1234
        return result
1242
1235
 
1243
1236
    def push_branch(self, source, revision_id=None, overwrite=False, 
1244
 
        remember=False, create_prefix=False):
 
1237
        remember=False):
1245
1238
        """Push the source branch into this BzrDir."""
1246
1239
        br_to = None
1247
1240
        # If we can open a branch, use its direct repository, otherwise see
1392
1385
        # that can do wonky stuff here, and that only
1393
1386
        # happens for creating checkouts, which cannot be
1394
1387
        # done on this format anyway. So - acceptable wart.
1395
 
        if hardlink:
1396
 
            warning("can't support hardlinked working trees in %r"
1397
 
                % (self,))
1398
1388
        try:
1399
1389
            result = self.open_workingtree(recommend_upgrade=False)
1400
1390
        except errors.NoSuchFile:
1641
1631
 
1642
1632
    def get_branch_transport(self, branch_format):
1643
1633
        """See BzrDir.get_branch_transport()."""
1644
 
        # XXX: this shouldn't implicitly create the directory if it's just
1645
 
        # promising to get a transport -- mbp 20090727
1646
1634
        if branch_format is None:
1647
1635
            return self.transport.clone('branch')
1648
1636
        try:
3046
3034
                      new is _mod_branch.BzrBranchFormat8):
3047
3035
                    branch_converter = _mod_branch.Converter7to8()
3048
3036
                else:
3049
 
                    raise errors.BadConversionTarget("No converter", new,
3050
 
                        branch._format)
 
3037
                    raise errors.BadConversionTarget("No converter", new)
3051
3038
                branch_converter.convert(branch)
3052
3039
                branch = self.bzrdir.open_branch()
3053
3040
                old = branch._format.__class__
3283
3270
        else:
3284
3271
            remote_repo = None
3285
3272
            policy = None
3286
 
        bzrdir._format.set_branch_format(self.get_branch_format())
3287
3273
        if require_stacking:
3288
3274
            # The repo has already been created, but we need to make sure that
3289
3275
            # we'll make a stackable branch.
3556
3542
            if self._require_stacking:
3557
3543
                raise
3558
3544
 
3559
 
    def requires_stacking(self):
3560
 
        """Return True if this policy requires stacking."""
3561
 
        return self._stack_on is not None and self._require_stacking
3562
 
 
3563
3545
    def _get_full_stack_on(self):
3564
3546
        """Get a fully-qualified URL for the stack_on location."""
3565
3547
        if self._stack_on is None:
3872
3854
# The following format should be an alias for the rich root equivalent 
3873
3855
# of the default format
3874
3856
format_registry.register_metadir('default-rich-root',
3875
 
    'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3876
 
    branch_format='bzrlib.branch.BzrBranchFormat7',
3877
 
    tree_format='bzrlib.workingtree.WorkingTreeFormat6',
 
3857
    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
 
3858
    help='Default format, rich root variant. (needed for bzr-svn and bzr-git).',
 
3859
    branch_format='bzrlib.branch.BzrBranchFormat6',
 
3860
    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3878
3861
    alias=True,
3879
 
    help='Same as 2a.')
3880
 
 
 
3862
    )
3881
3863
# The current format that is made on 'bzr init'.
3882
 
format_registry.set_default('2a')
 
3864
format_registry.set_default('pack-0.92')