~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Martin Pool
  • Date: 2006-03-10 06:29:53 UTC
  • mfrom: (1608 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060310062953-bc1c7ade75c89a7a
[merge] bzr.dev; pycurl not updated for readv yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical Ltd
2
 
 
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
 
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
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
144
144
        bzrdir.BzrDirFormat.register_format(format)
145
145
        # which bzrdir.Open will refuse (not supported)
146
146
        self.assertRaises(UnsupportedFormatError, bzrdir.BzrDir.open, url)
 
147
        # which bzrdir.open_containing will refuse (not supported)
 
148
        self.assertRaises(UnsupportedFormatError, bzrdir.BzrDir.open_containing, url)
147
149
        # but open_downlevel will work
148
150
        t = get_transport(url)
149
151
        self.assertEqual(format.open(t), bzrdir.BzrDir.open_unsupported(url))
387
389
        self.assertEqual(checkout_base,
388
390
                         dir.get_workingtree_transport(workingtree.WorkingTreeFormat3()).base)
389
391
 
 
392
    def test_meta1dir_uses_lockdir(self):
 
393
        """Meta1 format uses a LockDir to guard the whole directory, not a file."""
 
394
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
 
395
        t = dir.transport
 
396
        self.assertIsDirectory('branch-lock', t)
 
397
 
390
398
        
391
399
class TestFormat5(TestCaseWithTransport):
392
400
    """Tests specific to the version 5 bzrdir format."""
492
500
        finally:
493
501
            bzrdir.BzrDirFormat.set_default_format(old_format)
494
502
 
 
503
    def test_clone(self):
 
504
        # clone into a nonlocal path works
 
505
        old_format = bzrdir.BzrDirFormat.get_default_format()
 
506
        bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
 
507
        try:
 
508
            branch = bzrdir.BzrDir.create_branch_convenience('local')
 
509
        finally:
 
510
            bzrdir.BzrDirFormat.set_default_format(old_format)
 
511
        branch.bzrdir.open_workingtree()
 
512
        result = branch.bzrdir.clone(self.get_url('remote'))
 
513
        self.assertRaises(errors.NoWorkingTree,
 
514
                          result.open_workingtree)
 
515
        result.open_branch()
 
516
        result.open_repository()
 
517