~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_bound_branches.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-19 08:31:08 UTC
  • mfrom: (1666.1.5 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060419083108-fab2970f4575b010
Change the default branch format to be metadir. (Robert Collins, Aaron Bentley).

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        bzr = self.run_bzr
68
68
        self.build_tree(['base/', 'base/a', 'base/b'])
69
69
 
70
 
        self.init_meta_branch('base')
71
 
        os.chdir('base')
72
 
        bzr('add')
73
 
        bzr('commit', '-m', 'init')
74
 
 
75
 
        os.chdir('..')
76
 
 
77
 
        bzr('checkout', 'base', 'child')
78
 
 
79
 
        self.failUnlessExists('child')
 
70
        branch = self.init_meta_branch('base')
 
71
        tree = branch.bzrdir.open_workingtree()
 
72
        tree.lock_write()
 
73
        tree.add(['a', 'b'])
 
74
        tree.commit('init')
 
75
        tree.unlock()
 
76
 
 
77
        self.run_bzr('checkout', 'base', 'child')
80
78
 
81
79
        self.check_revno(1, 'child')
82
80
        d = BzrDir.open('child')
83
81
        self.assertNotEqual(None, d.open_branch().get_master_branch())
84
82
 
85
 
    def check_revno(self, val, loc=None):
86
 
        if loc is not None:
87
 
            cwd = os.getcwd()
88
 
            os.chdir(loc)
89
 
        self.assertEquals(str(val), self.run_bzr('revno')[0].strip())
90
 
        if loc is not None:
91
 
            os.chdir(cwd)
 
83
    def check_revno(self, val, loc='.'):
 
84
        self.assertEqual(
 
85
            val, len(BzrDir.open(loc).open_branch().revision_history()))
92
86
 
93
87
    def test_simple_binding(self):
94
88
        self.build_tree(['base/', 'base/a', 'base/b'])
114
108
        old_format = BzrDirFormat.get_default_format()
115
109
        BzrDirFormat.set_default_format(BzrDirMetaFormat1())
116
110
        try:
117
 
            self.run_bzr('init', path)
 
111
            return BzrDir.create_branch_convenience(
 
112
                path, BzrDirMetaFormat1())
118
113
        finally:
119
114
            BzrDirFormat.set_default_format(old_format)
120
115
 
286
281
        self.check_revno(5)
287
282
 
288
283
    def test_bind_child_ahead(self):
 
284
        # test binding when the master branches history is a prefix of the 
 
285
        # childs
289
286
        bzr = self.run_bzr
290
287
        self.create_branches()
 
288
        return
291
289
 
292
290
        os.chdir('child')
293
291
        bzr('unbind')