~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012 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
36
36
    # Success modes
37
37
 
38
38
    def test_remove_tree_original_branch(self):
39
 
        os.chdir('branch1')
40
 
        self.run_bzr('remove-tree')
41
 
        self.assertPathDoesNotExist('foo')
 
39
        self.run_bzr('remove-tree', working_dir='branch1')
 
40
        self.assertPathDoesNotExist('branch1/foo')
42
41
 
43
42
    def test_remove_tree_original_branch_explicit(self):
44
43
        self.run_bzr('remove-tree branch1')
53
52
    def test_remove_tree_sprouted_branch(self):
54
53
        self.tree.bzrdir.sprout('branch2')
55
54
        self.assertPathExists('branch2/foo')
56
 
        os.chdir('branch2')
57
 
        self.run_bzr('remove-tree')
58
 
        self.assertPathDoesNotExist('foo')
 
55
        self.run_bzr('remove-tree', working_dir='branch2')
 
56
        self.assertPathDoesNotExist('branch2/foo')
59
57
 
60
58
    def test_remove_tree_sprouted_branch_explicit(self):
61
59
        self.tree.bzrdir.sprout('branch2')
66
64
    def test_remove_tree_checkout(self):
67
65
        self.tree.branch.create_checkout('branch2', lightweight=False)
68
66
        self.assertPathExists('branch2/foo')
69
 
        os.chdir('branch2')
70
 
        self.run_bzr('remove-tree')
71
 
        self.assertPathDoesNotExist('foo')
72
 
        os.chdir('..')
 
67
        self.run_bzr('remove-tree', working_dir='branch2')
 
68
        self.assertPathDoesNotExist('branch2/foo')
73
69
        self.assertPathExists('branch1/foo')
74
70
 
75
71
    def test_remove_tree_checkout_explicit(self):
84
80
    def test_remove_tree_lightweight_checkout(self):
85
81
        self.tree.branch.create_checkout('branch2', lightweight=True)
86
82
        self.assertPathExists('branch2/foo')
87
 
        os.chdir('branch2')
88
83
        output = self.run_bzr_error(
89
84
            ["You cannot remove the working tree from a lightweight checkout"],
90
 
            'remove-tree', retcode=3)
91
 
        self.assertPathExists('foo')
92
 
        os.chdir('..')
 
85
            'remove-tree', retcode=3, working_dir='branch2')
 
86
        self.assertPathExists('branch2/foo')
93
87
        self.assertPathExists('branch1/foo')
94
88
 
95
89
    def test_remove_tree_lightweight_checkout_explicit(self):
103
97
 
104
98
    def test_remove_tree_empty_dir(self):
105
99
        os.mkdir('branch2')
106
 
        os.chdir('branch2')
107
 
        output = self.run_bzr_error(["Not a branch"],
108
 
                                    'remove-tree', retcode=3)
 
100
        output = self.run_bzr_error(
 
101
            ["Not a branch"], 'remove-tree', retcode=3, working_dir='branch2')
109
102
 
110
103
    def test_remove_tree_repeatedly(self):
111
104
        self.run_bzr('remove-tree branch1')