168
166
def test_annotate_cmd_revspec_branch(self):
169
167
tree = self._setup_edited_file('trunk')
170
168
tree.branch.create_checkout(self.get_url('work'), lightweight=True)
172
out, err = self.run_bzr('annotate file -r branch:../trunk')
169
out, err = self.run_bzr(['annotate', 'file', '-r', 'branch:../trunk'],
173
171
self.assertEqual('', err)
174
172
self.assertEqual(
175
173
'1 test@ho | foo\n'
211
209
tree.merge_from_branch(tree.branch, "rev1.1.1")
212
210
# edit the file to be 'resolved' and have a further local edit
213
211
self.build_tree_contents([('file', 'local\nfoo\nbar\nbaz\ngam\n')])
215
214
def test_annotated_edited_merged_file_revnos(self):
216
self._create_merged_file()
217
out, err = self.run_bzr('annotate file')
218
email = extract_email_address(Branch.open('.').get_config().username())
215
wt = self._create_merged_file()
216
out, err = self.run_bzr(['annotate', 'file'])
217
email = extract_email_address(wt.branch.get_config().username())
219
218
self.assertEqual(
220
219
'3? %-7s | local\n'
221
220
'1 test@ho | foo\n'
238
237
def test_annotate_empty_file(self):
239
tree = self.make_branch_and_tree('tree')
240
self.build_tree_contents([('tree/empty', '')])
238
tree = self.make_branch_and_tree('.')
239
self.build_tree_contents([('empty', '')])
241
240
tree.add('empty')
242
241
tree.commit('add empty file')
245
out, err = self.run_bzr('annotate empty')
242
out, err = self.run_bzr(['annotate', 'empty'])
246
243
self.assertEqual('', out)
248
245
def test_annotate_removed_file(self):
249
tree = self.make_branch_and_tree('tree')
250
self.build_tree_contents([('tree/empty', '')])
246
tree = self.make_branch_and_tree('.')
247
self.build_tree_contents([('empty', '')])
251
248
tree.add('empty')
252
249
tree.commit('add empty file')
253
250
# delete the file.
254
251
tree.remove('empty')
255
252
tree.commit('remove empty file')
258
out, err = self.run_bzr('annotate -r1 empty')
253
out, err = self.run_bzr(['annotate', '-r1', 'empty'])
259
254
self.assertEqual('', out)
261
256
def test_annotate_empty_file_show_ids(self):
262
tree = self.make_branch_and_tree('tree')
263
self.build_tree_contents([('tree/empty', '')])
257
tree = self.make_branch_and_tree('.')
258
self.build_tree_contents([('empty', '')])
264
259
tree.add('empty')
265
260
tree.commit('add empty file')
268
261
out, err = self.run_bzr(['annotate', '--show-ids', 'empty'])
269
262
self.assertEqual('', out)
271
264
def test_annotate_nonexistant_file(self):
272
tree = self.make_branch_and_tree('tree')
273
self.build_tree(['tree/file'])
265
tree = self.make_branch_and_tree('.')
266
self.build_tree(['file'])
274
267
tree.add(['file'])
275
268
tree.commit('add a file')
278
out, err = self.run_bzr("annotate doesnotexist", retcode=3)
269
out, err = self.run_bzr(['annotate', 'doesnotexist'], retcode=3)
279
270
self.assertEqual('', out)
280
271
self.assertEqual("bzr: ERROR: doesnotexist is not versioned.\n", err)
282
273
def test_annotate_without_workingtree(self):
283
tree = self.make_branch_and_tree('branch')
284
self.build_tree_contents([('branch/empty', '')])
274
tree = self.make_branch_and_tree('.')
275
self.build_tree_contents([('empty', '')])
285
276
tree.add('empty')
286
277
tree.commit('add empty file')
287
278
bzrdir = tree.branch.bzrdir
288
279
bzrdir.destroy_workingtree()
289
280
self.assertFalse(bzrdir.has_workingtree())
292
out, err = self.run_bzr('annotate empty')
281
out, err = self.run_bzr(['annotate', 'empty'])
293
282
self.assertEqual('', out)
295
284
def test_annotate_directory(self):