~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-07-31 16:12:57 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060731161257-91a231523255332c
new official bzr.ico

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by 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
22
22
import shutil
23
23
import sys
24
24
 
25
 
from bzrlib import (
26
 
    branch as _mod_branch,
27
 
    bzrdir,
28
 
    errors,
29
 
    workingtree,
30
 
    )
 
25
import bzrlib.bzrdir as bzrdir
 
26
import bzrlib.errors as errors
31
27
from bzrlib.tests.blackbox import ExternalBase
32
28
 
33
29
 
42
38
        tree.commit('2', rev_id='2')
43
39
 
44
40
    def test_checkout_makes_bound_branch(self):
45
 
        self.run_bzr('checkout branch checkout')
 
41
        self.runbzr('checkout branch checkout')
46
42
        # if we have a checkout, the branch base should be 'branch'
47
43
        source = bzrdir.BzrDir.open('branch')
48
44
        result = bzrdir.BzrDir.open('checkout')
50
46
                         result.open_branch().get_bound_location())
51
47
 
52
48
    def test_checkout_light_makes_checkout(self):
53
 
        self.run_bzr('checkout --lightweight branch checkout')
 
49
        self.runbzr('checkout --lightweight branch checkout')
54
50
        # if we have a checkout, the branch base should be 'branch'
55
51
        source = bzrdir.BzrDir.open('branch')
56
52
        result = bzrdir.BzrDir.open('checkout')
58
54
                         result.open_branch().bzrdir.root_transport.base)
59
55
 
60
56
    def test_checkout_dash_r(self):
61
 
        self.run_bzr('checkout -r -2 branch checkout')
 
57
        self.runbzr('checkout -r -2 branch checkout')
62
58
        # the working tree should now be at revision '1' with the content
63
59
        # from 1.
64
60
        result = bzrdir.BzrDir.open('checkout')
65
 
        self.assertEqual(['1'], result.open_workingtree().get_parent_ids())
 
61
        self.assertEqual('1', result.open_workingtree().last_revision())
66
62
        self.failIfExists('checkout/added_in_2')
67
63
 
68
64
    def test_checkout_light_dash_r(self):
69
 
        self.run_bzr('checkout --lightweight -r -2 branch checkout')
 
65
        self.runbzr('checkout --lightweight -r -2 branch checkout')
70
66
        # the working tree should now be at revision '1' with the content
71
67
        # from 1.
72
68
        result = bzrdir.BzrDir.open('checkout')
73
 
        self.assertEqual(['1'], result.open_workingtree().get_parent_ids())
 
69
        self.assertEqual('1', result.open_workingtree().last_revision())
74
70
        self.failIfExists('checkout/added_in_2')
75
71
 
76
72
    def test_checkout_reconstitutes_working_trees(self):
84
80
            format=bzrdir.BzrDirMetaFormat1())
85
81
        # check no tree was created
86
82
        self.assertRaises(errors.NoWorkingTree, branch.bzrdir.open_workingtree)
87
 
        out, err = self.run_bzr('checkout treeless-branch')
 
83
        out, err = self.run_bzr('checkout', 'treeless-branch')
88
84
        # we should have a tree now
89
85
        branch.bzrdir.open_workingtree()
90
86
        # with no diff
91
 
        out, err = self.run_bzr('diff treeless-branch')
 
87
        out, err = self.run_bzr('diff', 'treeless-branch')
92
88
 
93
89
        # now test with no parameters
94
90
        branch = bzrdir.BzrDir.create_branch_convenience(
102
98
        branch.bzrdir.open_workingtree()
103
99
        # with no diff
104
100
        out, err = self.run_bzr('diff')
105
 
 
106
 
    def test_checkout_in_branch_with_r(self):
107
 
        branch = _mod_branch.Branch.open('branch')
108
 
        branch.bzrdir.destroy_workingtree()
109
 
        os.chdir('branch')
110
 
        self.run_bzr('checkout -r 1')
111
 
        tree = workingtree.WorkingTree.open('.')
112
 
        self.assertEqual('1', tree.last_revision())
113
 
        branch.bzrdir.destroy_workingtree()
114
 
        self.run_bzr('checkout -r 0')
115
 
        self.assertIs(None, tree.last_revision())