4763.2.4
by John Arbash Meinel
merge bzr.2.1 in preparation for NEWS entry. |
1 |
# Copyright (C) 2005-2010 Canonical Ltd
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
2 |
# -*- coding: utf-8 -*-
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
3 |
#
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
4 |
# This program is free software; you can redistribute it and/or modify
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
8 |
#
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
9 |
# This program is distributed in the hope that it will be useful,
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
13 |
#
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
14 |
# You should have received a copy of the GNU General Public License
|
15 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
17 |
|
18 |
||
19 |
"""Black-box tests for bzr.
|
|
20 |
||
21 |
These check that it behaves properly when it's invoked through the regular
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
22 |
command-line interface. This doesn't actually run a new interpreter but
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
23 |
rather starts again from the run_bzr function.
|
24 |
"""
|
|
25 |
||
26 |
||
5967.2.2
by Jelmer Vernooij
add test |
27 |
from bzrlib import ( |
28 |
config, |
|
29 |
tests, |
|
30 |
)
|
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
31 |
|
6352.2.3
by Jelmer Vernooij
s/NoVfsCalls/ContainsNoVfsCalls/. |
32 |
from bzrlib.tests.matchers import ContainsNoVfsCalls |
4634.120.5
by Andrew Bennetts
Add test. |
33 |
from bzrlib.urlutils import joinpath |
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
34 |
|
35 |
||
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
36 |
class TestAnnotate(tests.TestCaseWithTransport): |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
37 |
|
1185.16.53
by Martin Pool
- annotate improvements from Goffreddo, with extra bug fixes and tests |
38 |
def setUp(self): |
39 |
super(TestAnnotate, self).setUp() |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
40 |
wt = self.make_branch_and_tree('.') |
41 |
b = wt.branch |
|
1185.33.31
by Martin Pool
Make annotate cope better with revisions committed without a valid |
42 |
self.build_tree_contents([('hello.txt', 'my helicopter\n'), |
43 |
('nomail.txt', 'nomail\n')]) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
44 |
wt.add(['hello.txt']) |
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
45 |
self.revision_id_1 = wt.commit('add hello', |
2182.3.12
by John Arbash Meinel
Force the timezone properly during tests which look at dates. |
46 |
committer='test@user', |
47 |
timestamp=1165960000.00, timezone=0) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
48 |
wt.add(['nomail.txt']) |
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
49 |
self.revision_id_2 = wt.commit('add nomail', |
2182.3.12
by John Arbash Meinel
Force the timezone properly during tests which look at dates. |
50 |
committer='no mail', |
51 |
timestamp=1165970000.00, timezone=0) |
|
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
52 |
self.build_tree_contents([('hello.txt', 'my helicopter\n' |
53 |
'your helicopter\n')]) |
|
54 |
self.revision_id_3 = wt.commit('mod hello', |
|
2182.3.12
by John Arbash Meinel
Force the timezone properly during tests which look at dates. |
55 |
committer='user@test', |
56 |
timestamp=1166040000.00, timezone=0) |
|
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
57 |
self.build_tree_contents([('hello.txt', 'my helicopter\n' |
58 |
'your helicopter\n' |
|
59 |
'all of\n' |
|
60 |
'our helicopters\n' |
|
61 |
)])
|
|
62 |
self.revision_id_4 = wt.commit('mod hello', |
|
2182.3.12
by John Arbash Meinel
Force the timezone properly during tests which look at dates. |
63 |
committer='user@test', |
64 |
timestamp=1166050000.00, timezone=0) |
|
1185.16.53
by Martin Pool
- annotate improvements from Goffreddo, with extra bug fixes and tests |
65 |
|
1185.16.32
by Martin Pool
- add a basic annotate built-in command |
66 |
def test_help_annotate(self): |
67 |
"""Annotate command exists"""
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
68 |
out, err = self.run_bzr('--no-plugins annotate --help') |
1185.16.53
by Martin Pool
- annotate improvements from Goffreddo, with extra bug fixes and tests |
69 |
|
70 |
def test_annotate_cmd(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
71 |
out, err = self.run_bzr('annotate hello.txt') |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
72 |
self.assertEqual('', err) |
73 |
self.assertEqualDiff('''\ |
|
2182.3.3
by John Arbash Meinel
Add tests for annotate with dotted revnos. |
74 |
1 test@us | my helicopter
|
75 |
3 user@te | your helicopter
|
|
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
76 |
4 user@te | all of
|
77 |
| our helicopters
|
|
78 |
''', out) |
|
79 |
||
80 |
def test_annotate_cmd_full(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
81 |
out, err = self.run_bzr('annotate hello.txt --all') |
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
82 |
self.assertEqual('', err) |
83 |
self.assertEqualDiff('''\ |
|
84 |
1 test@us | my helicopter
|
|
85 |
3 user@te | your helicopter
|
|
86 |
4 user@te | all of
|
|
87 |
4 user@te | our helicopters
|
|
88 |
''', out) |
|
89 |
||
90 |
def test_annotate_cmd_long(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
91 |
out, err = self.run_bzr('annotate hello.txt --long') |
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
92 |
self.assertEqual('', err) |
93 |
self.assertEqualDiff('''\ |
|
94 |
1 test@user 20061212 | my helicopter
|
|
95 |
3 user@test 20061213 | your helicopter
|
|
96 |
4 user@test 20061213 | all of
|
|
97 |
| our helicopters
|
|
98 |
''', out) |
|
99 |
||
100 |
def test_annotate_cmd_show_ids(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
101 |
out, err = self.run_bzr('annotate hello.txt --show-ids') |
2182.3.7
by John Arbash Meinel
Cleanup and add blackbox tests for annotate. |
102 |
max_len = max([len(self.revision_id_1), |
103 |
len(self.revision_id_3), |
|
104 |
len(self.revision_id_4)]) |
|
105 |
self.assertEqual('', err) |
|
106 |
self.assertEqualDiff('''\ |
|
107 |
%*s | my helicopter |
|
108 |
%*s | your helicopter |
|
109 |
%*s | all of |
|
110 |
%*s | our helicopters |
|
111 |
''' % (max_len, self.revision_id_1, |
|
112 |
max_len, self.revision_id_3, |
|
113 |
max_len, self.revision_id_4, |
|
114 |
max_len, '', |
|
115 |
)
|
|
116 |
, out) |
|
1185.33.31
by Martin Pool
Make annotate cope better with revisions committed without a valid |
117 |
|
118 |
def test_no_mail(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
119 |
out, err = self.run_bzr('annotate nomail.txt') |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
120 |
self.assertEqual('', err) |
121 |
self.assertEqualDiff('''\ |
|
2182.3.3
by John Arbash Meinel
Add tests for annotate with dotted revnos. |
122 |
2 no mail | nomail
|
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
123 |
''', out) |
1694.2.6
by Martin Pool
[merge] bzr.dev |
124 |
|
125 |
def test_annotate_cmd_revision(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
126 |
out, err = self.run_bzr('annotate hello.txt -r1') |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
127 |
self.assertEqual('', err) |
128 |
self.assertEqualDiff('''\ |
|
2182.3.3
by John Arbash Meinel
Add tests for annotate with dotted revnos. |
129 |
1 test@us | my helicopter
|
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
130 |
''', out) |
1694.2.6
by Martin Pool
[merge] bzr.dev |
131 |
|
1558.14.6
by Aaron Bentley
Added annotate test |
132 |
def test_annotate_cmd_revision3(self): |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
133 |
out, err = self.run_bzr('annotate hello.txt -r3') |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
134 |
self.assertEqual('', err) |
135 |
self.assertEqualDiff('''\ |
|
2182.3.3
by John Arbash Meinel
Add tests for annotate with dotted revnos. |
136 |
1 test@us | my helicopter
|
137 |
3 user@te | your helicopter
|
|
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
138 |
''', out) |
1558.14.6
by Aaron Bentley
Added annotate test |
139 |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
140 |
def test_annotate_cmd_unknown_revision(self): |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
141 |
out, err = self.run_bzr('annotate hello.txt -r 10', |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
142 |
retcode=3) |
143 |
self.assertEqual('', out) |
|
5105.1.4
by Vincent Ladeuil
Use single quotes so that no test need to be updated. |
144 |
self.assertContainsRe(err, "Requested revision: '10' does not exist") |
1694.2.6
by Martin Pool
[merge] bzr.dev |
145 |
|
146 |
def test_annotate_cmd_two_revisions(self): |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
147 |
out, err = self.run_bzr('annotate hello.txt -r1..2', |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
148 |
retcode=3) |
149 |
self.assertEqual('', out) |
|
150 |
self.assertEqual('bzr: ERROR: bzr annotate --revision takes' |
|
3655.3.1
by Lukáš Lalinský
Fix `bzr st -rbranch:PATH_TO_BRANCH` |
151 |
' exactly one revision identifier\n', |
2182.3.6
by John Arbash Meinel
Cleanup annotate blackbox tests |
152 |
err) |
2027.3.1
by John Arbash Meinel
'bzr annotate' shouldn't fail on an empty file: fix bug #56814 |
153 |
|
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
154 |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
155 |
class TestSimpleAnnotate(tests.TestCaseWithTransport): |
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
156 |
"""Annotate tests with no complex setup."""
|
157 |
||
4634.120.5
by Andrew Bennetts
Add test. |
158 |
def _setup_edited_file(self, relpath='.'): |
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
159 |
"""Create a tree with a locally edited file."""
|
4634.120.5
by Andrew Bennetts
Add test. |
160 |
tree = self.make_branch_and_tree(relpath) |
161 |
file_relpath = joinpath(relpath, 'file') |
|
162 |
self.build_tree_contents([(file_relpath, 'foo\ngam\n')]) |
|
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
163 |
tree.add('file') |
3603.4.3
by Robert Collins
Review feedback. |
164 |
tree.commit('add file', committer="test@host", rev_id="rev1") |
4634.120.5
by Andrew Bennetts
Add test. |
165 |
self.build_tree_contents([(file_relpath, 'foo\nbar\ngam\n')]) |
166 |
return tree |
|
167 |
||
168 |
def test_annotate_cmd_revspec_branch(self): |
|
169 |
tree = self._setup_edited_file('trunk') |
|
170 |
tree.branch.create_checkout(self.get_url('work'), lightweight=True) |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
171 |
out, err = self.run_bzr(['annotate', 'file', '-r', 'branch:../trunk'], |
172 |
working_dir='work') |
|
4634.120.5
by Andrew Bennetts
Add test. |
173 |
self.assertEqual('', err) |
174 |
self.assertEqual( |
|
175 |
'1 test@ho | foo\n' |
|
176 |
' | gam\n', |
|
177 |
out) |
|
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
178 |
|
179 |
def test_annotate_edited_file(self): |
|
180 |
tree = self._setup_edited_file() |
|
6421.3.2
by Vincent Ladeuil
Further simplify test. |
181 |
self.overrideEnv('BZR_EMAIL', 'current@host2') |
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
182 |
out, err = self.run_bzr('annotate file') |
183 |
self.assertEqual( |
|
184 |
'1 test@ho | foo\n' |
|
185 |
'2? current | bar\n' |
|
186 |
'1 test@ho | gam\n', |
|
187 |
out) |
|
188 |
||
5967.2.2
by Jelmer Vernooij
add test |
189 |
def test_annotate_edited_file_no_default(self): |
190 |
# Ensure that when no username is available annotate still works.
|
|
191 |
self.overrideEnv('EMAIL', None) |
|
192 |
self.overrideEnv('BZR_EMAIL', None) |
|
193 |
# Also, make sure that it's not inferred from mailname.
|
|
194 |
self.overrideAttr(config, '_auto_user_id', |
|
195 |
lambda: (None, None)) |
|
196 |
tree = self._setup_edited_file() |
|
197 |
out, err = self.run_bzr('annotate file') |
|
198 |
self.assertEqual( |
|
199 |
'1 test@ho | foo\n' |
|
200 |
'2? local u | bar\n' |
|
201 |
'1 test@ho | gam\n', |
|
202 |
out) |
|
203 |
||
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
204 |
def test_annotate_edited_file_show_ids(self): |
205 |
tree = self._setup_edited_file() |
|
6421.3.1
by Vincent Ladeuil
Migrate more branch options to config stacks. |
206 |
self.overrideEnv('BZR_EMAIL', 'current@host2') |
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
207 |
out, err = self.run_bzr('annotate file --show-ids') |
208 |
self.assertEqual( |
|
3603.4.3
by Robert Collins
Review feedback. |
209 |
' rev1 | foo\n' |
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
210 |
'current: | bar\n' |
3603.4.3
by Robert Collins
Review feedback. |
211 |
' rev1 | gam\n', |
212 |
out) |
|
213 |
||
214 |
def _create_merged_file(self): |
|
215 |
"""Create a file with a pending merge and local edit."""
|
|
216 |
tree = self.make_branch_and_tree('.') |
|
217 |
self.build_tree_contents([('file', 'foo\ngam\n')]) |
|
218 |
tree.add('file') |
|
219 |
tree.commit('add file', rev_id="rev1", committer="test@host") |
|
220 |
# right side
|
|
221 |
self.build_tree_contents([('file', 'foo\nbar\ngam\n')]) |
|
222 |
tree.commit("right", rev_id="rev1.1.1", committer="test@host") |
|
223 |
tree.pull(tree.branch, True, "rev1") |
|
224 |
# left side
|
|
225 |
self.build_tree_contents([('file', 'foo\nbaz\ngam\n')]) |
|
226 |
tree.commit("left", rev_id="rev2", committer="test@host") |
|
227 |
# merge
|
|
228 |
tree.merge_from_branch(tree.branch, "rev1.1.1") |
|
229 |
# edit the file to be 'resolved' and have a further local edit
|
|
230 |
self.build_tree_contents([('file', 'local\nfoo\nbar\nbaz\ngam\n')]) |
|
5638.2.4
by Vincent Ladeuil
Delete one more import. |
231 |
return tree |
3603.4.3
by Robert Collins
Review feedback. |
232 |
|
233 |
def test_annotated_edited_merged_file_revnos(self): |
|
5638.2.4
by Vincent Ladeuil
Delete one more import. |
234 |
wt = self._create_merged_file() |
235 |
out, err = self.run_bzr(['annotate', 'file']) |
|
6449.6.1
by Jelmer Vernooij
Use config stacks in a few more places in the test suite. |
236 |
email = config.extract_email_address( |
237 |
wt.branch.get_config_stack().get('email')) |
|
3603.4.3
by Robert Collins
Review feedback. |
238 |
self.assertEqual( |
3603.4.5
by Robert Collins
Fix test failure on PQM. |
239 |
'3? %-7s | local\n' |
3603.4.3
by Robert Collins
Review feedback. |
240 |
'1 test@ho | foo\n' |
241 |
'1.1.1 test@ho | bar\n' |
|
242 |
'2 test@ho | baz\n' |
|
3603.4.5
by Robert Collins
Fix test failure on PQM. |
243 |
'1 test@ho | gam\n' % email[:7], |
3603.4.3
by Robert Collins
Review feedback. |
244 |
out) |
245 |
||
246 |
def test_annotated_edited_merged_file_ids(self): |
|
247 |
self._create_merged_file() |
|
5638.2.4
by Vincent Ladeuil
Delete one more import. |
248 |
out, err = self.run_bzr(['annotate', 'file', '--show-ids']) |
3603.4.3
by Robert Collins
Review feedback. |
249 |
self.assertEqual( |
250 |
'current: | local\n' |
|
251 |
' rev1 | foo\n' |
|
252 |
'rev1.1.1 | bar\n' |
|
253 |
' rev2 | baz\n' |
|
254 |
' rev1 | gam\n', |
|
3603.4.1
by Robert Collins
Implement lookups into the current working tree for bzr annotate, fixing bug 3439. |
255 |
out) |
256 |
||
2027.3.1
by John Arbash Meinel
'bzr annotate' shouldn't fail on an empty file: fix bug #56814 |
257 |
def test_annotate_empty_file(self): |
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
258 |
tree = self.make_branch_and_tree('.') |
259 |
self.build_tree_contents([('empty', '')]) |
|
2027.3.1
by John Arbash Meinel
'bzr annotate' shouldn't fail on an empty file: fix bug #56814 |
260 |
tree.add('empty') |
261 |
tree.commit('add empty file') |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
262 |
out, err = self.run_bzr(['annotate', 'empty']) |
2027.3.1
by John Arbash Meinel
'bzr annotate' shouldn't fail on an empty file: fix bug #56814 |
263 |
self.assertEqual('', out) |
2561.2.1
by James Westby
Display a useful error message when annotating a non-existant file (#122656) |
264 |
|
5638.2.1
by Andrew King
Fix 537442 - cannot annotate deleted file |
265 |
def test_annotate_removed_file(self): |
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
266 |
tree = self.make_branch_and_tree('.') |
267 |
self.build_tree_contents([('empty', '')]) |
|
5638.2.1
by Andrew King
Fix 537442 - cannot annotate deleted file |
268 |
tree.add('empty') |
269 |
tree.commit('add empty file') |
|
270 |
# delete the file.
|
|
271 |
tree.remove('empty') |
|
272 |
tree.commit('remove empty file') |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
273 |
out, err = self.run_bzr(['annotate', '-r1', 'empty']) |
5638.2.1
by Andrew King
Fix 537442 - cannot annotate deleted file |
274 |
self.assertEqual('', out) |
275 |
||
3960.1.1
by Vincent Ladeuil
Fix bug #314525: don't try to put ids if there is no annotation. |
276 |
def test_annotate_empty_file_show_ids(self): |
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
277 |
tree = self.make_branch_and_tree('.') |
278 |
self.build_tree_contents([('empty', '')]) |
|
3960.1.1
by Vincent Ladeuil
Fix bug #314525: don't try to put ids if there is no annotation. |
279 |
tree.add('empty') |
280 |
tree.commit('add empty file') |
|
281 |
out, err = self.run_bzr(['annotate', '--show-ids', 'empty']) |
|
282 |
self.assertEqual('', out) |
|
283 |
||
2561.2.1
by James Westby
Display a useful error message when annotating a non-existant file (#122656) |
284 |
def test_annotate_nonexistant_file(self): |
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
285 |
tree = self.make_branch_and_tree('.') |
286 |
self.build_tree(['file']) |
|
2561.2.1
by James Westby
Display a useful error message when annotating a non-existant file (#122656) |
287 |
tree.add(['file']) |
288 |
tree.commit('add a file') |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
289 |
out, err = self.run_bzr(['annotate', 'doesnotexist'], retcode=3) |
2561.2.1
by James Westby
Display a useful error message when annotating a non-existant file (#122656) |
290 |
self.assertEqual('', out) |
2745.3.2
by Daniel Watkins
Updated tests to reflect new error text. |
291 |
self.assertEqual("bzr: ERROR: doesnotexist is not versioned.\n", err) |
3146.2.1
by Lukáš Lalinský
Don't require a working tree in cmd_annotate. |
292 |
|
293 |
def test_annotate_without_workingtree(self): |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
294 |
tree = self.make_branch_and_tree('.') |
295 |
self.build_tree_contents([('empty', '')]) |
|
3146.2.1
by Lukáš Lalinský
Don't require a working tree in cmd_annotate. |
296 |
tree.add('empty') |
297 |
tree.commit('add empty file') |
|
298 |
bzrdir = tree.branch.bzrdir |
|
299 |
bzrdir.destroy_workingtree() |
|
300 |
self.assertFalse(bzrdir.has_workingtree()) |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
301 |
out, err = self.run_bzr(['annotate', 'empty']) |
3146.2.1
by Lukáš Lalinský
Don't require a working tree in cmd_annotate. |
302 |
self.assertEqual('', out) |
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
303 |
|
304 |
def test_annotate_directory(self): |
|
305 |
"""Test --directory option"""
|
|
306 |
wt = self.make_branch_and_tree('a') |
|
307 |
self.build_tree_contents([('a/hello.txt', 'my helicopter\n')]) |
|
308 |
wt.add(['hello.txt']) |
|
309 |
wt.commit('commit', committer='test@user') |
|
5638.2.3
by Vincent Ladeuil
Freshen up the tests to a more modern style. |
310 |
out, err = self.run_bzr(['annotate', '-d', 'a', 'hello.txt']) |
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
311 |
self.assertEqualDiff('1 test@us | my helicopter\n', out) |
6283.1.8
by Jelmer Vernooij
Add hpss call count test for 'bzr annotate'. |
312 |
|
313 |
||
314 |
class TestSmartServerAnnotate(tests.TestCaseWithTransport): |
|
315 |
||
316 |
def test_simple_annotate(self): |
|
317 |
self.setup_smart_server_with_call_log() |
|
318 |
wt = self.make_branch_and_tree('branch') |
|
319 |
self.build_tree_contents([('branch/hello.txt', 'my helicopter\n')]) |
|
320 |
wt.add(['hello.txt']) |
|
321 |
wt.commit('commit', committer='test@user') |
|
322 |
self.reset_smart_call_log() |
|
323 |
out, err = self.run_bzr(['annotate', "-d", self.get_url('branch'), |
|
324 |
"hello.txt"]) |
|
325 |
# This figure represent the amount of work to perform this use case. It
|
|
326 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
327 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
328 |
# become necessary for this use case. Please do not adjust this number
|
|
329 |
# upwards without agreement from bzr's network support maintainers.
|
|
6213.1.61
by Jelmer Vernooij
Fix tests. |
330 |
self.assertLength(16, self.hpss_calls) |
6366.1.4
by Jelmer Vernooij
Test connection count calls for most blackbox commands. |
331 |
self.assertLength(1, self.hpss_connections) |
6352.2.2
by Jelmer Vernooij
Use new NoVfsCalls matcher in blackbox tests. |
332 |
self.expectFailure("annotate accesses inventories, which require VFS access", |
6352.2.3
by Jelmer Vernooij
s/NoVfsCalls/ContainsNoVfsCalls/. |
333 |
self.assertThat, self.hpss_calls, ContainsNoVfsCalls) |