~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-02-22 04:29:54 UTC
  • mfrom: (1566 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060222042954-60333f08dd56a646
[merge] from bzr.dev before integration
Fix undefined ordering in sign_my_revisions breaking tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
 
2
# -*- coding: utf-8 -*-
2
3
 
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
23
24
import sys
24
25
 
25
26
import bzrlib.bzrdir as bzrdir
26
 
import bzrlib.errors as errors
27
27
from bzrlib.tests.blackbox import ExternalBase
28
28
 
29
29
 
37
37
        tree.add('added_in_2')
38
38
        tree.commit('2', rev_id='2')
39
39
 
40
 
    def test_checkout_makes_bound_branch(self):
 
40
    def test_checkout_makes_checkout(self):
41
41
        self.runbzr('checkout branch checkout')
42
42
        # if we have a checkout, the branch base should be 'branch'
43
43
        source = bzrdir.BzrDir.open('branch')
44
44
        result = bzrdir.BzrDir.open('checkout')
45
45
        self.assertEqual(source.open_branch().bzrdir.root_transport.base,
46
 
                         result.open_branch().get_bound_location())
47
 
 
48
 
    def test_checkout_light_makes_checkout(self):
49
 
        self.runbzr('checkout --lightweight branch checkout')
50
 
        # if we have a checkout, the branch base should be 'branch'
51
 
        source = bzrdir.BzrDir.open('branch')
52
 
        result = bzrdir.BzrDir.open('checkout')
53
 
        self.assertEqual(source.open_branch().bzrdir.root_transport.base,
54
46
                         result.open_branch().bzrdir.root_transport.base)
55
47
 
56
48
    def test_checkout_dash_r(self):
61
53
        self.assertEqual('1', result.open_workingtree().last_revision())
62
54
        self.failIfExists('checkout/added_in_2')
63
55
 
64
 
    def test_checkout_light_dash_r(self):
65
 
        self.runbzr('checkout --lightweight -r -2 branch checkout')
66
 
        # the working tree should now be at revision '1' with the content
67
 
        # from 1.
68
 
        result = bzrdir.BzrDir.open('checkout')
69
 
        self.assertEqual('1', result.open_workingtree().last_revision())
70
 
        self.failIfExists('checkout/added_in_2')
71
 
 
72
 
    def test_checkout_reconstitutes_working_trees(self):
73
 
        # doing a 'bzr checkout' in the directory of a branch with no tree
74
 
        # or a 'bzr checkout path' with path the name of a directory with
75
 
        # a branch with no tree will reconsistute the tree.
76
 
        os.mkdir('treeless-branch')
77
 
        branch = bzrdir.BzrDir.create_branch_convenience(
78
 
            'treeless-branch',
79
 
            force_new_tree=False,
80
 
            format=bzrdir.BzrDirMetaFormat1())
81
 
        # check no tree was created
82
 
        self.assertRaises(errors.NoWorkingTree, branch.bzrdir.open_workingtree)
83
 
        out, err = self.run_bzr('checkout', 'treeless-branch')
84
 
        # we should have a tree now
85
 
        branch.bzrdir.open_workingtree()
86
 
        # with no diff
87
 
        out, err = self.run_bzr('diff', 'treeless-branch')
88
 
 
89
 
        # now test with no parameters
90
 
        branch = bzrdir.BzrDir.create_branch_convenience(
91
 
            '.',
92
 
            force_new_tree=False,
93
 
            format=bzrdir.BzrDirMetaFormat1())
94
 
        # check no tree was created
95
 
        self.assertRaises(errors.NoWorkingTree, branch.bzrdir.open_workingtree)
96
 
        out, err = self.run_bzr('checkout')
97
 
        # we should have a tree now
98
 
        branch.bzrdir.open_workingtree()
99
 
        # with no diff
100
 
        out, err = self.run_bzr('diff')