~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        self.assertFalse(b._transport.has('branch-name'))
66
66
        b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True)
67
67
 
 
68
    def test_branch_no_to_location(self):
 
69
        """The to_location is derived from the source branch name."""
 
70
        os.mkdir("something")
 
71
        a = self.example_branch('something/a').branch
 
72
        self.run_bzr('branch something/a')
 
73
        b = branch.Branch.open('a')
 
74
        self.assertEquals(b.last_revision_info(), a.last_revision_info())
 
75
 
68
76
    def test_into_colocated(self):
69
77
        """Branch from a branch into a colocated branch."""
70
78
        self.example_branch('a')
147
155
        #  => new branch will be created, but switch fails and the current
148
156
        #     branch is unmodified
149
157
        self.example_branch('a')
150
 
        self.make_branch_and_tree('current')
 
158
        tree = self.make_branch_and_tree('current')
 
159
        c1 = tree.commit('some diverged change')
151
160
        self.run_bzr_error(['Cannot switch a branch, only a checkout'],
152
161
            'branch --switch ../a ../b', working_dir='current')
153
162
        a = branch.Branch.open('a')
154
163
        b = branch.Branch.open('b')
155
164
        self.assertEqual(a.last_revision(), b.last_revision())
156
165
        work = branch.Branch.open('current')
157
 
        self.assertEqual(work.last_revision(), _mod_revision.NULL_REVISION)
 
166
        self.assertEqual(work.last_revision(), c1)
 
167
 
 
168
    def test_branch_into_empty_dir(self):
 
169
        t = self.example_branch('source')
 
170
        self.make_bzrdir('target')
 
171
        self.run_bzr("branch source target")
 
172
        self.assertEquals(2, len(t.branch.repository.all_revision_ids()))
158
173
 
159
174
    def test_branch_switch_checkout(self):
160
175
        # Checkout in the current directory: