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