~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

Modified mkdir functionality, to handle multiple nested trees.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        self.failIf(delta.modified)
81
81
 
82
82
 
 
83
    def test_mkdir_w_nested_trees(self):
 
84
        """'bzr mkdir' with nested trees"""
 
85
 
 
86
        self.run_bzr('init')
 
87
        os.mkdir('a')
 
88
        os.chdir('a')
 
89
        self.run_bzr('init')
 
90
        os.mkdir('b')
 
91
        os.chdir('b')
 
92
        self.run_bzr('init')
 
93
        os.chdir('../..')
 
94
 
 
95
        self.run_bzr('mkdir', 'dir', 'a/dir', 'a/b/dir')
 
96
        self.failUnless(os.path.isdir('dir'))
 
97
        self.failUnless(os.path.isdir('a/dir'))
 
98
        self.failUnless(os.path.isdir('a/b/dir'))
 
99
 
 
100
        from bzrlib.diff import compare_trees
 
101
        b = Branch.open('.')
 
102
        b_a = Branch.open('a')
 
103
        b_b = Branch.open('a/b')
 
104
        
 
105
        delta = compare_trees(b.basis_tree(), b.working_tree())
 
106
        self.assertEquals(len(delta.added), 1)
 
107
        self.assertEquals(delta.added[0][0], 'dir')
 
108
        self.failIf(delta.modified)
 
109
 
 
110
        delta = compare_trees(b_a.basis_tree(), b_a.working_tree())
 
111
        self.assertEquals(len(delta.added), 1)
 
112
        self.assertEquals(delta.added[0][0], 'dir')
 
113
        self.failIf(delta.modified)
 
114
 
 
115
        delta = compare_trees(b_b.basis_tree(), b_b.working_tree())
 
116
        self.assertEquals(len(delta.added), 1)
 
117
        self.assertEquals(delta.added[0][0], 'dir')
 
118
        self.failIf(delta.modified)
 
119
 
 
120
 
83
121
    def test_branch_add_in_unversioned(self):
84
122
        """Try to add a file in an unversioned directory.
85
123