~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-03-08 04:06:06 UTC
  • mfrom: (2323.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070308040606-84gsniv56huiyjt4
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 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
24
 
from bzrlib.repository import RepositoryFormatKnit1
 
22
from bzrlib import branch, bzrdir
 
23
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
25
24
from bzrlib.tests.blackbox import ExternalBase
26
25
from bzrlib.workingtree import WorkingTree
27
26
 
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
 
        self.assertEqual('2', target.open_workingtree().last_revision())
 
70
        self.assertEqual(['2'], target.open_workingtree().get_parent_ids())
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)