~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005,2006 by Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by 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
19
19
 
20
20
import os
21
21
 
22
 
import bzrlib.branch
23
 
import bzrlib.bzrdir
 
22
from bzrlib import branch, bzrdir
24
23
from bzrlib.repository import RepositoryFormatKnit1
25
24
from bzrlib.tests.blackbox import ExternalBase
26
25
from bzrlib.workingtree import WorkingTree
44
43
        self.example_branch()
45
44
        os.chdir('..')
46
45
        self.runbzr('branch a b')
47
 
        b = bzrlib.branch.Branch.open('b')
 
46
        b = branch.Branch.open('b')
48
47
        self.assertEqual('b\n', b.control_files.get_utf8('branch-name').read())
49
48
        self.runbzr('branch a c -r 1')
50
49
        os.chdir('b')
66
65
        self.assertFalse(source.branch.repository.has_revision('2'))
67
66
        dir = source.bzrdir
68
67
        self.runbzr('branch source target --basis commit_tree')
69
 
        target = bzrlib.bzrdir.BzrDir.open('target')
 
68
        target = bzrdir.BzrDir.open('target')
70
69
        self.assertEqual('2', target.open_branch().last_revision())
71
70
        self.assertEqual('2', target.open_workingtree().last_revision())
72
71
        self.assertTrue(target.open_branch().repository.has_revision('2'))
73
72
 
74
73
    def test_branch_only_copies_history(self):
75
74
        # Knit branches should only push the history for the current revision.
76
 
        format = bzrlib.bzrdir.BzrDirMetaFormat1()
 
75
        format = bzrdir.BzrDirMetaFormat1()
77
76
        format.repository_format = RepositoryFormatKnit1()
78
77
        shared_repo = self.make_repository('repo', format=format, shared=True)
79
78
        shared_repo.set_make_working_trees(True)