~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-17 08:50:40 UTC
  • mfrom: (1704.2.18 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060517085040-ee6e33957c557fba
(mbp) merge 0.8 fixes; fix #32587

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
        wt.rename_one('hello.txt', 'gutentag.txt')
95
95
        out, err = self.run_bzr("commit", "-m", "renamed")
96
96
        self.assertEqual('', out)
97
 
        self.assertEqual('renamed gutentag.txt\n'
 
97
        self.assertEqual('renamed hello.txt => gutentag.txt\n'
98
98
                         'Committed revision 2.\n',
99
99
                         err)
100
100
 
107
107
        out, err = self.run_bzr("commit", "-m", "renamed")
108
108
        self.assertEqual('', out)
109
109
        self.assertEqualDiff('added subdir\n'
110
 
                             'renamed subdir/hello.txt\n'
 
110
                             'renamed hello.txt => subdir/hello.txt\n'
111
111
                             'Committed revision 2.\n',
112
112
                             err)
113
113
 
123
123
                         'Committed revision 1.\n',
124
124
                         err)
125
125
 
126
 
    def test_16_verbose_commit_with_unchanged(self):
 
126
    def test_verbose_commit_with_unchanged(self):
127
127
        """Unchanged files should not be listed by default in verbose output"""
128
128
        self.runbzr("init")
129
129
        self.build_tree(['hello.txt', 'unchanged.txt'])
136
136
                         'Committed revision 2.\n',
137
137
                         err)
138
138
 
 
139
    def test_commit_merge_reports_all_modified_files(self):
 
140
        # the commit command should show all the files that are shown by
 
141
        # bzr diff or bzr status when committing, even when they were not
 
142
        # changed by the user but rather through doing a merge.
 
143
        this_tree = self.make_branch_and_tree('this')
 
144
        # we need a bunch of files and dirs, to perform one action on each.
 
145
        self.build_tree([
 
146
            'this/dirtorename/',
 
147
            'this/dirtoreparent/',
 
148
            'this/dirtoleave/',
 
149
            'this/dirtoremove/',
 
150
            'this/filetoreparent',
 
151
            'this/filetorename',
 
152
            'this/filetomodify',
 
153
            'this/filetoremove',
 
154
            'this/filetoleave']
 
155
            )
 
156
        this_tree.add([
 
157
            'dirtorename',
 
158
            'dirtoreparent',
 
159
            'dirtoleave',
 
160
            'dirtoremove',
 
161
            'filetoreparent',
 
162
            'filetorename',
 
163
            'filetomodify',
 
164
            'filetoremove',
 
165
            'filetoleave']
 
166
            )
 
167
        this_tree.commit('create_files')
 
168
        other_dir = this_tree.bzrdir.sprout('other')
 
169
        other_tree = other_dir.open_workingtree()
 
170
        other_tree.lock_write()
 
171
        # perform the needed actions on the files and dirs.
 
172
        try:
 
173
            other_tree.rename_one('dirtorename', 'renameddir')
 
174
            other_tree.rename_one('dirtoreparent', 'renameddir/reparenteddir')
 
175
            other_tree.rename_one('filetorename', 'renamedfile')
 
176
            other_tree.rename_one('filetoreparent', 'renameddir/reparentedfile')
 
177
            other_tree.remove(['dirtoremove', 'filetoremove'])
 
178
            self.build_tree_contents([
 
179
                ('other/newdir/', ),
 
180
                ('other/filetomodify', 'new content'),
 
181
                ('other/newfile', 'new file content')])
 
182
            other_tree.add('newfile')
 
183
            other_tree.add('newdir/')
 
184
            other_tree.commit('modify all sample files and dirs.')
 
185
        finally:
 
186
            other_tree.unlock()
 
187
        self.merge(other_tree.branch, this_tree)
 
188
        os.chdir('this')
 
189
        out,err = self.run_bzr("commit", "-m", "added")
 
190
        os.chdir('..')
 
191
        self.assertEqual('', out)
 
192
        self.assertEqualDiff(
 
193
            'modified filetomodify\n'
 
194
            'added newdir\n'
 
195
            'added newfile\n'
 
196
            'renamed dirtorename => renameddir\n'
 
197
            'renamed dirtoreparent => renameddir/reparenteddir\n'
 
198
            'renamed filetoreparent => renameddir/reparentedfile\n'
 
199
            'renamed filetorename => renamedfile\n'
 
200
            'deleted dirtoremove\n'
 
201
            'deleted filetoremove\n'
 
202
            'Committed revision 2.\n',
 
203
            err)
 
204
 
139
205
    def test_empty_commit_message(self):
140
206
        self.runbzr("init")
141
207
        file('foo.c', 'wt').write('int main() {}')