62
62
def test_help_annotate(self):
63
63
"""Annotate command exists"""
64
out, err = self.run_bzr('--no-plugins annotate --help')
64
out, err = self.run_bzr('--no-plugins', 'annotate', '--help')
66
66
def test_annotate_cmd(self):
67
out, err = self.run_bzr('annotate hello.txt')
67
out, err = self.run_bzr('annotate', 'hello.txt')
68
68
self.assertEqual('', err)
69
69
self.assertEqualDiff('''\
70
70
1 test@us | my helicopter
76
76
def test_annotate_cmd_full(self):
77
out, err = self.run_bzr('annotate hello.txt --all')
77
out, err = self.run_bzr('annotate', 'hello.txt', '--all')
78
78
self.assertEqual('', err)
79
79
self.assertEqualDiff('''\
80
80
1 test@us | my helicopter
86
86
def test_annotate_cmd_long(self):
87
out, err = self.run_bzr('annotate hello.txt --long')
87
out, err = self.run_bzr('annotate', 'hello.txt', '--long')
88
88
self.assertEqual('', err)
89
89
self.assertEqualDiff('''\
90
90
1 test@user 20061212 | my helicopter
96
96
def test_annotate_cmd_show_ids(self):
97
out, err = self.run_bzr('annotate hello.txt --show-ids')
97
out, err = self.run_bzr('annotate', 'hello.txt', '--show-ids')
98
98
max_len = max([len(self.revision_id_1),
99
99
len(self.revision_id_3),
100
100
len(self.revision_id_4)])
114
114
def test_no_mail(self):
115
out, err = self.run_bzr('annotate nomail.txt')
115
out, err = self.run_bzr('annotate', 'nomail.txt')
116
116
self.assertEqual('', err)
117
117
self.assertEqualDiff('''\
118
118
2 no mail | nomail
121
121
def test_annotate_cmd_revision(self):
122
out, err = self.run_bzr('annotate hello.txt -r1')
122
out, err = self.run_bzr('annotate', 'hello.txt', '-r1')
123
123
self.assertEqual('', err)
124
124
self.assertEqualDiff('''\
125
125
1 test@us | my helicopter
128
128
def test_annotate_cmd_revision3(self):
129
out, err = self.run_bzr('annotate hello.txt -r3')
129
out, err = self.run_bzr('annotate', 'hello.txt', '-r3')
130
130
self.assertEqual('', err)
131
131
self.assertEqualDiff('''\
132
132
1 test@us | my helicopter
136
136
def test_annotate_cmd_unknown_revision(self):
137
out, err = self.run_bzr('annotate hello.txt -r 10',
137
out, err = self.run_bzr('annotate', 'hello.txt', '-r', '10',
139
139
self.assertEqual('', out)
140
140
self.assertContainsRe(err, 'Requested revision: \'10\' does not exist')
142
142
def test_annotate_cmd_two_revisions(self):
143
out, err = self.run_bzr('annotate hello.txt -r1..2',
143
out, err = self.run_bzr('annotate', 'hello.txt', '-r1..2',
145
145
self.assertEqual('', out)
146
146
self.assertEqual('bzr: ERROR: bzr annotate --revision takes'
154
154
tree.commit('add empty file')
157
out, err = self.run_bzr('annotate empty')
158
self.assertEqual('', out)
160
def test_annotate_nonexistant_file(self):
161
tree = self.make_branch_and_tree('tree')
162
self.build_tree(['tree/file'])
164
tree.commit('add a file')
167
out, err = self.run_bzr("annotate doesnotexist", retcode=3)
168
self.assertEqual('', out)
169
self.assertEqual("bzr: ERROR: doesnotexist is not versioned.\n", err)
171
def test_annotate_without_workingtree(self):
172
tree = self.make_branch_and_tree('branch')
173
self.build_tree_contents([('branch/empty', '')])
175
tree.commit('add empty file')
176
bzrdir = tree.branch.bzrdir
177
bzrdir.destroy_workingtree()
178
self.assertFalse(bzrdir.has_workingtree())
181
out, err = self.run_bzr('annotate empty')
157
out, err = self.run_bzr('annotate', 'empty')
182
158
self.assertEqual('', out)