~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.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
25
25
from StringIO import StringIO
26
26
 
27
27
import bzrlib.branch
 
28
from bzrlib.branch import (BzrBranch5, 
 
29
                           BzrBranchFormat5)
28
30
import bzrlib.bzrdir as bzrdir
 
31
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1, 
 
32
                           BzrDir, BzrDirFormat)
29
33
from bzrlib.errors import (NotBranchError,
30
34
                           UnknownFormatError,
31
35
                           UnsupportedFormatError,
44
48
        try:
45
49
            # the default branch format is used by the meta dir format
46
50
            # which is not the default bzrdir format at this point
47
 
            dir = bzrdir.BzrDirMetaFormat1().initialize('memory:/')
 
51
            dir = BzrDirMetaFormat1().initialize('memory:/')
48
52
            result = dir.create_branch()
49
53
            self.assertEqual(result, 'A branch')
50
54
        finally:
52
56
        self.assertEqual(old_format, bzrlib.branch.BranchFormat.get_default_format())
53
57
 
54
58
 
 
59
class TestBranchFormat5(TestCaseWithTransport):
 
60
    """Tests specific to branch format 5"""
 
61
 
 
62
    def test_branch_format_5_uses_lockdir(self):
 
63
        url = self.get_url()
 
64
        bzrdir = BzrDirMetaFormat1().initialize(url)
 
65
        bzrdir.create_repository()
 
66
        branch = bzrdir.create_branch()
 
67
        t = self.get_transport()
 
68
        self.log("branch instance is %r" % branch)
 
69
        self.assert_(isinstance(branch, BzrBranch5))
 
70
        self.assertIsDirectory('.', t)
 
71
        self.assertIsDirectory('.bzr/branch', t)
 
72
        self.assertIsDirectory('.bzr/branch/lock', t)
 
73
        branch.lock_write()
 
74
        self.assertIsDirectory('.bzr/branch/lock/held', t)
 
75
 
 
76
 
55
77
class SampleBranchFormat(bzrlib.branch.BranchFormat):
56
78
    """A sample format
57
79