~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Robert Collins
  • Date: 2005-11-13 18:57:26 UTC
  • mfrom: (1185.31.9)
  • Revision ID: robertc@robertcollins.net-20051113185726-39ede10d746eee6d
Merge Johns current integration work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
        self.assertEquals(delta.added[0][0], 'foo')
54
54
        self.failIf(delta.modified)
55
55
 
 
56
    def test_mkdir_in_subdir(self):
 
57
        """'bzr mkdir' operation in subdirectory"""
 
58
 
 
59
        self.run_bzr('init')
 
60
        self.run_bzr('mkdir', 'dir')
 
61
        self.assert_(os.path.isdir('dir'))
 
62
 
 
63
        os.chdir('dir')
 
64
        self.log('Run mkdir in subdir')
 
65
        self.run_bzr('mkdir', 'subdir')
 
66
        self.assert_(os.path.isdir('subdir'))
 
67
        os.chdir('..')
 
68
 
 
69
        from bzrlib.diff import compare_trees
 
70
        from bzrlib.branch import Branch
 
71
        b = Branch.open('.')
 
72
        
 
73
        delta = compare_trees(b.basis_tree(), b.working_tree())
 
74
 
 
75
        self.log('delta.added = %r' % delta.added)
 
76
 
 
77
        self.assertEquals(len(delta.added), 2)
 
78
        self.assertEquals(delta.added[0][0], 'dir')
 
79
        self.assertEquals(delta.added[1][0], os.path.join('dir','subdir'))
 
80
        self.failIf(delta.modified)
 
81
 
 
82
    def test_mkdir_w_nested_trees(self):
 
83
        """'bzr mkdir' with nested trees"""
 
84
 
 
85
        self.run_bzr('init')
 
86
        os.mkdir('a')
 
87
        os.chdir('a')
 
88
        self.run_bzr('init')
 
89
        os.mkdir('b')
 
90
        os.chdir('b')
 
91
        self.run_bzr('init')
 
92
        os.chdir('../..')
 
93
 
 
94
        self.run_bzr('mkdir', 'dir', 'a/dir', 'a/b/dir')
 
95
        self.failUnless(os.path.isdir('dir'))
 
96
        self.failUnless(os.path.isdir('a/dir'))
 
97
        self.failUnless(os.path.isdir('a/b/dir'))
 
98
 
 
99
        from bzrlib.diff import compare_trees
 
100
        b = Branch.open('.')
 
101
        b_a = Branch.open('a')
 
102
        b_b = Branch.open('a/b')
 
103
        
 
104
        delta = compare_trees(b.basis_tree(), b.working_tree())
 
105
        self.assertEquals(len(delta.added), 1)
 
106
        self.assertEquals(delta.added[0][0], 'dir')
 
107
        self.failIf(delta.modified)
 
108
 
 
109
        delta = compare_trees(b_a.basis_tree(), b_a.working_tree())
 
110
        self.assertEquals(len(delta.added), 1)
 
111
        self.assertEquals(delta.added[0][0], 'dir')
 
112
        self.failIf(delta.modified)
 
113
 
 
114
        delta = compare_trees(b_b.basis_tree(), b_b.working_tree())
 
115
        self.assertEquals(len(delta.added), 1)
 
116
        self.assertEquals(delta.added[0][0], 'dir')
 
117
        self.failIf(delta.modified)
 
118
 
56
119
    def test_branch_add_in_unversioned(self):
57
120
        """Try to add a file in an unversioned directory.
58
121
 
160
223
        debug('check branch...')
161
224
        from bzrlib.check import check
162
225
        check(b, False)
163
 
        
164
 
 
165
 
        
 
226
 
 
227
 
166
228
class SubdirCommit(TestCaseInTempDir):
167
229
 
168
230
    def test_subdir_commit(self):