/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

[broken] fix up display of files changed by a commit

Needs an additional cherrypick to work well because the tests depend on 
new behaviour of 'bzr commit DIR'

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        wt.rename_one('hello.txt', 'gutentag.txt')
74
74
        out, err = self.run_bzr("commit", "-m", "renamed")
75
75
        self.assertEqual('', out)
76
 
        self.assertEqual('renamed gutentag.txt\n'
 
76
        self.assertEqual('renamed hello.txt => gutentag.txt\n'
77
77
                         'Committed revision 2.\n',
78
78
                         err)
79
79
 
86
86
        out, err = self.run_bzr("commit", "-m", "renamed")
87
87
        self.assertEqual('', out)
88
88
        self.assertEqualDiff('added subdir\n'
89
 
                             'renamed subdir/hello.txt\n'
 
89
                             'renamed hello.txt => subdir/hello.txt\n'
90
90
                             'Committed revision 2.\n',
91
91
                             err)
92
92
 
102
102
                         'Committed revision 1.\n',
103
103
                         err)
104
104
 
105
 
    def test_16_verbose_commit_with_unchanged(self):
 
105
    def test_verbose_commit_with_unchanged(self):
106
106
        """Unchanged files should not be listed by default in verbose output"""
107
107
        self.runbzr("init")
108
108
        self.build_tree(['hello.txt', 'unchanged.txt'])
115
115
                         'Committed revision 2.\n',
116
116
                         err)
117
117
 
 
118
    def test_commit_merge_reports_all_modified_files(self):
 
119
        # the commit command should show all the files that are shown by
 
120
        # bzr diff or bzr status when committing, even when they were not
 
121
        # changed by the user but rather through doing a merge.
 
122
        this_tree = self.make_branch_and_tree('this')
 
123
        # we need a bunch of files and dirs, to perform one action on each.
 
124
        self.build_tree([
 
125
            'this/dirtorename/',
 
126
            'this/dirtoreparent/',
 
127
            'this/dirtoleave/',
 
128
            'this/dirtoremove/',
 
129
            'this/filetoreparent',
 
130
            'this/filetorename',
 
131
            'this/filetomodify',
 
132
            'this/filetoremove',
 
133
            'this/filetoleave']
 
134
            )
 
135
        this_tree.add([
 
136
            'dirtorename',
 
137
            'dirtoreparent',
 
138
            'dirtoleave',
 
139
            'dirtoremove',
 
140
            'filetoreparent',
 
141
            'filetorename',
 
142
            'filetomodify',
 
143
            'filetoremove',
 
144
            'filetoleave']
 
145
            )
 
146
        this_tree.commit('create_files')
 
147
        other_dir = this_tree.bzrdir.sprout('other')
 
148
        other_tree = other_dir.open_workingtree()
 
149
        other_tree.lock_write()
 
150
        # perform the needed actions on the files and dirs.
 
151
        try:
 
152
            other_tree.rename_one('dirtorename', 'renameddir')
 
153
            other_tree.rename_one('dirtoreparent', 'renameddir/reparenteddir')
 
154
            other_tree.rename_one('filetorename', 'renamedfile')
 
155
            other_tree.rename_one('filetoreparent', 'renameddir/reparentedfile')
 
156
            other_tree.remove(['dirtoremove', 'filetoremove'])
 
157
            self.build_tree_contents([
 
158
                ('other/newdir/', ),
 
159
                ('other/filetomodify', 'new content'),
 
160
                ('other/newfile', 'new file content')])
 
161
            other_tree.add('newfile')
 
162
            other_tree.add('newdir/')
 
163
            other_tree.commit('modify all sample files and dirs.')
 
164
        finally:
 
165
            other_tree.unlock()
 
166
        self.merge(other_tree.branch, this_tree)
 
167
        os.chdir('this')
 
168
        out,err = self.run_bzr("commit", "-m", "added")
 
169
        os.chdir('..')
 
170
        self.assertEqual('', out)
 
171
        self.assertEqualDiff(
 
172
            'modified filetomodify\n'
 
173
            'added newdir\n'
 
174
            'added newfile\n'
 
175
            'renamed dirtorename => renameddir\n'
 
176
            'renamed dirtoreparent => renameddir/reparenteddir\n'
 
177
            'renamed filetoreparent => renameddir/reparentedfile\n'
 
178
            'renamed filetorename => renamedfile\n'
 
179
            'deleted dirtoremove\n'
 
180
            'deleted filetoremove\n'
 
181
            'Committed revision 2.\n',
 
182
            err)
 
183
 
118
184
    def test_empty_commit_message(self):
119
185
        self.runbzr("init")
120
186
        file('foo.c', 'wt').write('int main() {}')