~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-01-05 17:56:30 UTC
  • mfrom: (6434 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120105175630-kp0kt0el27s40q0x
Merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    controldir,
26
26
    errors,
27
27
    revision as _mod_revision,
 
28
    tests,
28
29
    )
29
30
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
30
 
from bzrlib.tests import TestCaseWithTransport
31
31
from bzrlib.tests import (
32
32
    fixtures,
33
33
    test_server,
43
43
from bzrlib.workingtree import WorkingTree
44
44
 
45
45
 
46
 
class TestBranch(TestCaseWithTransport):
 
46
class TestBranch(tests.TestCaseWithTransport):
47
47
 
48
48
    def example_branch(self, path='.', format=None):
49
49
        tree = self.make_branch_and_tree(path, format=format)
83
83
        self.assertEqual('', err)
84
84
        out,err = self.run_bzr('branch a file:b,branch=orig', retcode=3)
85
85
        self.assertEqual('', out)
86
 
        self.assertEqual('bzr: ERROR: Already a branch: "file:b,branch=orig".\n', err)
 
86
        self.assertEqual(
 
87
            'bzr: ERROR: Already a branch: "file:b,branch=orig".\n', err)
87
88
 
88
89
    def test_from_colocated(self):
89
90
        """Branch from a colocated branch into a regular branch."""
113
114
            else:
114
115
                corrupt = '\xFF'
115
116
            f.write(corrupt) # make sure we corrupt something
116
 
        self.run_bzr_error(['Corruption while decompressing repository file'], 
 
117
        self.run_bzr_error(['Corruption while decompressing repository file'],
117
118
                            'branch a b', retcode=3)
118
119
 
119
120
    def test_branch_switch_no_branch(self):
175
176
        #     the new branch
176
177
        self.example_branch('a')
177
178
        self.run_bzr('checkout --lightweight a current')
178
 
        out, err = self.run_bzr('branch --switch ../a ../b', working_dir='current')
 
179
        out, err = self.run_bzr('branch --switch ../a ../b',
 
180
                                working_dir='current')
179
181
        a = branch.Branch.open('a')
180
182
        b = branch.Branch.open('b')
181
183
        self.assertEqual(a.last_revision(), b.last_revision())
345
347
        new_branch.repository.get_revision('rev-2')
346
348
 
347
349
 
348
 
class TestBranchStacked(TestCaseWithTransport):
 
350
class TestBranchStacked(tests.TestCaseWithTransport):
349
351
    """Tests for branch --stacked"""
350
352
 
351
353
    def assertRevisionInRepository(self, repo_path, revid):
352
 
        """Check that a revision is in a repository, disregarding stacking."""
 
354
        """Check that a revision is in a repo, disregarding stacking."""
353
355
        repo = bzrdir.BzrDir.open(repo_path).open_repository()
354
356
        self.assertTrue(repo.has_revision(revid))
355
357
 
356
358
    def assertRevisionNotInRepository(self, repo_path, revid):
357
 
        """Check that a revision is not in a repository, disregarding stacking."""
 
359
        """Check that a revision is not in a repo, disregarding stacking."""
358
360
        repo = bzrdir.BzrDir.open(repo_path).open_repository()
359
361
        self.assertFalse(repo.has_revision(revid))
360
362
 
432
434
            trunk_tree.branch.base, err)
433
435
        self.assertRevisionNotInRepository('newbranch', original_revid)
434
436
        new_branch = branch.Branch.open('newbranch')
435
 
        self.assertEqual(trunk_tree.branch.base, new_branch.get_stacked_on_url())
 
437
        self.assertEqual(trunk_tree.branch.base,
 
438
                         new_branch.get_stacked_on_url())
436
439
 
437
440
    def test_branch_stacked_from_smart_server(self):
438
441
        # We can branch stacking on a smart server
473
476
            err)
474
477
 
475
478
 
476
 
class TestSmartServerBranching(TestCaseWithTransport):
 
479
class TestSmartServerBranching(tests.TestCaseWithTransport):
477
480
 
478
481
    def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):
479
482
        self.setup_smart_server_with_call_log()
598
601
        self.assertFalse(t.has('remote/file'))
599
602
 
600
603
 
601
 
class TestDeprecatedAliases(TestCaseWithTransport):
 
604
class TestDeprecatedAliases(tests.TestCaseWithTransport):
602
605
 
603
606
    def test_deprecated_aliases(self):
604
 
        """bzr branch can be called clone or get, but those names are deprecated.
 
607
        """bzr branch can be called clone or get, but those names are
 
608
        deprecated.
605
609
 
606
610
        See bug 506265.
607
611
        """