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')
242
out, err = self.run_bzr(['annotate', 'empty'])
243
self.assertEqual('', out)
245
out, err = self.run_bzr('annotate empty')
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'])
246
254
self.assertEqual('', out)
248
256
def test_annotate_empty_file_show_ids(self):
249
tree = self.make_branch_and_tree('tree')
250
self.build_tree_contents([('tree/empty', '')])
257
tree = self.make_branch_and_tree('.')
258
self.build_tree_contents([('empty', '')])
251
259
tree.add('empty')
252
260
tree.commit('add empty file')
255
261
out, err = self.run_bzr(['annotate', '--show-ids', 'empty'])
256
262
self.assertEqual('', out)
258
264
def test_annotate_nonexistant_file(self):
259
tree = self.make_branch_and_tree('tree')
260
self.build_tree(['tree/file'])
265
tree = self.make_branch_and_tree('.')
266
self.build_tree(['file'])
261
267
tree.add(['file'])
262
268
tree.commit('add a file')
265
out, err = self.run_bzr("annotate doesnotexist", retcode=3)
269
out, err = self.run_bzr(['annotate', 'doesnotexist'], retcode=3)
266
270
self.assertEqual('', out)
267
271
self.assertEqual("bzr: ERROR: doesnotexist is not versioned.\n", err)
269
273
def test_annotate_without_workingtree(self):
270
tree = self.make_branch_and_tree('branch')
271
self.build_tree_contents([('branch/empty', '')])
274
tree = self.make_branch_and_tree('.')
275
self.build_tree_contents([('empty', '')])
272
276
tree.add('empty')
273
277
tree.commit('add empty file')
274
278
bzrdir = tree.branch.bzrdir
275
279
bzrdir.destroy_workingtree()
276
280
self.assertFalse(bzrdir.has_workingtree())
279
out, err = self.run_bzr('annotate empty')
281
out, err = self.run_bzr(['annotate', 'empty'])
280
282
self.assertEqual('', out)
282
284
def test_annotate_directory(self):
285
287
self.build_tree_contents([('a/hello.txt', 'my helicopter\n')])
286
288
wt.add(['hello.txt'])
287
289
wt.commit('commit', committer='test@user')
288
out, err = self.run_bzr('annotate -d a hello.txt')
290
out, err = self.run_bzr(['annotate', '-d', 'a', 'hello.txt'])
289
291
self.assertEqualDiff('1 test@us | my helicopter\n', out)