~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-06 09:10:02 UTC
  • mfrom: (5816.6.19 bazaar_source)
  • Revision ID: pqm@pqm.ubuntu.com-20110506091002-ge55v96dgz9hfz67
(vila) Set correct parent when using 'switch -b' with bound branches (Fix
 for Bug #513709). (Dr Al)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.tests import (
31
31
    fixtures,
32
32
    HardlinkFeature,
 
33
    script,
33
34
    test_server,
34
35
    )
 
36
from bzrlib.tests.blackbox import test_switch
35
37
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
36
38
from bzrlib.tests.script import run_script
37
39
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
516
518
            2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead.
517
519
            2>bzr: ERROR: Not a branch...
518
520
            """ % locals())
 
521
 
 
522
 
 
523
class TestBranchParentLocation(test_switch.TestSwitchParentLocationBase):
 
524
 
 
525
    def _checkout_and_branch(self, option=''):
 
526
        self.script_runner.run_script(self, '''
 
527
                $ bzr checkout %(option)s repo/trunk checkout
 
528
                $ cd checkout
 
529
                $ bzr branch --switch ../repo/trunk ../repo/branched
 
530
                2>Branched 0 revision(s).
 
531
                2>Tree is up to date at revision 0.
 
532
                2>Switched to branch:...branched...
 
533
                $ cd ..
 
534
                ''' % locals())
 
535
        bound_branch = branch.Branch.open_containing('checkout')[0]
 
536
        master_branch = branch.Branch.open_containing('repo/branched')[0]
 
537
        return (bound_branch, master_branch)
 
538
 
 
539
    def test_branch_switch_parent_lightweight(self):
 
540
        """Lightweight checkout using bzr branch --switch."""
 
541
        bb, mb = self._checkout_and_branch(option='--lightweight')
 
542
        self.assertParent('repo/trunk', bb)
 
543
        self.assertParent('repo/trunk', mb)
 
544
 
 
545
    def test_branch_switch_parent_heavyweight(self):
 
546
        """Heavyweight checkout using bzr branch --switch."""
 
547
        bb, mb = self._checkout_and_branch()
 
548
        self.assertParent('repo/trunk', bb)
 
549
        self.assertParent('repo/trunk', mb)