2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2005, 2006 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
915
by Martin Pool
- add simple test case for bzr status |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
915
by Martin Pool
- add simple test case for bzr status |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
915
by Martin Pool
- add simple test case for bzr status |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
915
by Martin Pool
- add simple test case for bzr status |
16 |
|
17 |
"""Tests of status command.
|
|
18 |
||
19 |
Most of these depend on the particular formatting used.
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
20 |
As such they really are blackbox tests even though some of the
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
21 |
tests are not using self.capture. If we add tests for the programmatic
|
22 |
interface later, they will be non blackbox tests.
|
|
915
by Martin Pool
- add simple test case for bzr status |
23 |
"""
|
24 |
||
1185.33.71
by Martin Pool
Status tests include unicode character. |
25 |
from cStringIO import StringIO |
1685.1.80
by Wouter van Heyst
more code cleanup |
26 |
import codecs |
1551.10.9
by Aaron Bentley
Add test cases for status with kind change |
27 |
from os import mkdir, chdir, rmdir, unlink |
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
28 |
import sys |
1185.33.71
by Martin Pool
Status tests include unicode character. |
29 |
from tempfile import TemporaryFile |
30 |
||
1551.15.58
by Aaron Bentley
Status honours selected paths for conflicts (#127606) |
31 |
from bzrlib import ( |
32 |
bzrdir, |
|
33 |
conflicts, |
|
34 |
errors, |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
35 |
osutils, |
1551.15.58
by Aaron Bentley
Status honours selected paths for conflicts (#127606) |
36 |
)
|
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
37 |
import bzrlib.branch |
38 |
from bzrlib.osutils import pathjoin |
|
1948.4.33
by John Arbash Meinel
Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin) |
39 |
from bzrlib.revisionspec import RevisionSpec |
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
40 |
from bzrlib.status import show_tree_status |
1685.1.75
by Wouter van Heyst
more tests handle LANG=C |
41 |
from bzrlib.tests import TestCaseWithTransport, TestSkipped |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
42 |
from bzrlib.workingtree import WorkingTree |
43 |
||
915
by Martin Pool
- add simple test case for bzr status |
44 |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
45 |
class BranchStatus(TestCaseWithTransport): |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
46 |
|
2255.7.60
by Robert Collins
Make the assertStatus blackbox helper clearer. |
47 |
def assertStatus(self, expected_lines, working_tree, |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
48 |
revision=None, short=False, pending=True, verbose=False): |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
49 |
"""Run status in working_tree and look for output.
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
50 |
|
2255.7.60
by Robert Collins
Make the assertStatus blackbox helper clearer. |
51 |
:param expected_lines: The lines to look for.
|
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
52 |
:param working_tree: The tree to run status in.
|
53 |
"""
|
|
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
54 |
output_string = self.status_string(working_tree, revision, short, |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
55 |
pending, verbose) |
2255.7.60
by Robert Collins
Make the assertStatus blackbox helper clearer. |
56 |
self.assertEqual(expected_lines, output_string.splitlines(True)) |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
57 |
|
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
58 |
def status_string(self, wt, revision=None, short=False, pending=True, |
59 |
verbose=False): |
|
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
60 |
# use a real file rather than StringIO because it doesn't handle
|
61 |
# Unicode very well.
|
|
62 |
tof = codecs.getwriter('utf-8')(TemporaryFile()) |
|
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
63 |
show_tree_status(wt, to_file=tof, revision=revision, short=short, |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
64 |
show_pending=pending, verbose=verbose) |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
65 |
tof.seek(0) |
66 |
return tof.read().decode('utf-8') |
|
67 |
||
1836.1.16
by John Arbash Meinel
Cleanup some tests which don't expect .bazaar/ to show up. Some still fail. |
68 |
def test_branch_status(self): |
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
69 |
"""Test basic branch status"""
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
70 |
wt = self.make_branch_and_tree('.') |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
71 |
|
72 |
# status with no commits or files - it must
|
|
73 |
# work and show no output. We do this with no
|
|
74 |
# commits to be sure that it's not going to fail
|
|
75 |
# as a corner case.
|
|
76 |
self.assertStatus([], wt) |
|
77 |
||
78 |
self.build_tree(['hello.c', 'bye.c']) |
|
79 |
self.assertStatus([ |
|
80 |
'unknown:\n', |
|
81 |
' bye.c\n', |
|
82 |
' hello.c\n', |
|
83 |
],
|
|
84 |
wt) |
|
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
85 |
self.assertStatus([ |
1551.10.7
by Aaron Bentley
Use new-style output for status |
86 |
'? bye.c\n', |
87 |
'? hello.c\n', |
|
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
88 |
],
|
89 |
wt, short=True) |
|
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
90 |
|
91 |
# add a commit to allow showing pending merges.
|
|
1927.2.1
by Robert Collins
Alter set_pending_merges to shove the left most merge into the trees last-revision if that is not set. Related bugfixes include basis_tree handling ghosts, de-duping the merges with the last-revision and update changing where and how it adds its pending merge. |
92 |
wt.commit('create a parent to allow testing merge output') |
915
by Martin Pool
- add simple test case for bzr status |
93 |
|
1908.6.7
by Robert Collins
Remove all users of set_pending_merges and add_pending_merge except tests that they work correctly. |
94 |
wt.add_parent_tree_id('pending@pending-0-0') |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
95 |
self.assertStatus([ |
96 |
'unknown:\n', |
|
97 |
' bye.c\n', |
|
98 |
' hello.c\n', |
|
3936.2.3
by Ian Clatworthy
feedback from jameinel |
99 |
'pending merge tips: (use -v to see all merge revisions)\n', |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
100 |
' (ghost) pending@pending-0-0\n', |
101 |
],
|
|
102 |
wt) |
|
103 |
self.assertStatus([ |
|
104 |
'unknown:\n', |
|
105 |
' bye.c\n', |
|
106 |
' hello.c\n', |
|
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
107 |
'pending merges:\n', |
3377.3.41
by John Arbash Meinel
Fix up a couple of the tests |
108 |
' (ghost) pending@pending-0-0\n', |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
109 |
],
|
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
110 |
wt, verbose=True) |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
111 |
self.assertStatus([ |
1551.10.7
by Aaron Bentley
Use new-style output for status |
112 |
'? bye.c\n', |
113 |
'? hello.c\n', |
|
3377.3.41
by John Arbash Meinel
Fix up a couple of the tests |
114 |
'P (ghost) pending@pending-0-0\n', |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
115 |
],
|
116 |
wt, short=True) |
|
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
117 |
self.assertStatus([ |
118 |
'unknown:\n', |
|
119 |
' bye.c\n', |
|
120 |
' hello.c\n', |
|
121 |
],
|
|
122 |
wt, pending=False) |
|
123 |
self.assertStatus([ |
|
124 |
'? bye.c\n', |
|
125 |
'? hello.c\n', |
|
126 |
],
|
|
127 |
wt, short=True, pending=False) |
|
915
by Martin Pool
- add simple test case for bzr status |
128 |
|
1185.1.35
by Robert Collins
Heikki Paajanen's status -r patch |
129 |
def test_branch_status_revisions(self): |
130 |
"""Tests branch status with revisions"""
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
131 |
wt = self.make_branch_and_tree('.') |
1185.1.35
by Robert Collins
Heikki Paajanen's status -r patch |
132 |
|
133 |
self.build_tree(['hello.c', 'bye.c']) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
134 |
wt.add('hello.c') |
135 |
wt.add('bye.c') |
|
136 |
wt.commit('Test message') |
|
1185.1.35
by Robert Collins
Heikki Paajanen's status -r patch |
137 |
|
1948.4.36
by John Arbash Meinel
[merge] bzr.dev 1978 |
138 |
revs = [RevisionSpec.from_string('0')] |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
139 |
self.assertStatus([ |
140 |
'added:\n', |
|
141 |
' bye.c\n', |
|
142 |
' hello.c\n' |
|
143 |
],
|
|
144 |
wt, |
|
145 |
revision=revs) |
|
1185.1.35
by Robert Collins
Heikki Paajanen's status -r patch |
146 |
|
147 |
self.build_tree(['more.c']) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
148 |
wt.add('more.c') |
149 |
wt.commit('Another test message') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
150 |
|
1948.4.33
by John Arbash Meinel
Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin) |
151 |
revs.append(RevisionSpec.from_string('1')) |
1927.2.3
by Robert Collins
review comment application - paired with Martin. |
152 |
self.assertStatus([ |
153 |
'added:\n', |
|
154 |
' bye.c\n', |
|
155 |
' hello.c\n', |
|
156 |
],
|
|
157 |
wt, |
|
158 |
revision=revs) |
|
1185.12.27
by Aaron Bentley
Use line log for pending merges |
159 |
|
160 |
def test_pending(self): |
|
1185.33.71
by Martin Pool
Status tests include unicode character. |
161 |
"""Pending merges display works, including Unicode"""
|
1185.12.27
by Aaron Bentley
Use line log for pending merges |
162 |
mkdir("./branch") |
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
163 |
wt = self.make_branch_and_tree('branch') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
164 |
b = wt.branch |
165 |
wt.commit("Empty commit 1") |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
166 |
b_2_dir = b.bzrdir.sprout('./copy') |
167 |
b_2 = b_2_dir.open_branch() |
|
168 |
wt2 = b_2_dir.open_workingtree() |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
169 |
wt.commit(u"\N{TIBETAN DIGIT TWO} Empty commit 2") |
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
170 |
wt2.merge_from_branch(wt.branch) |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
171 |
message = self.status_string(wt2, verbose=True) |
2296.1.1
by Martin Pool
Make tests for truncation of status output more robust on wide terminals. |
172 |
self.assertStartsWith(message, "pending merges:\n") |
173 |
self.assertEndsWith(message, "Empty commit 2\n") |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
174 |
wt2.commit("merged") |
1185.16.88
by mbp at sourcefrog
Make commit message long enough in test for pending merges |
175 |
# must be long to make sure we see elipsis at the end
|
2296.1.1
by Martin Pool
Make tests for truncation of status output more robust on wide terminals. |
176 |
wt.commit("Empty commit 3 " + |
177 |
"blah blah blah blah " * 100) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
178 |
wt2.merge_from_branch(wt.branch) |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
179 |
message = self.status_string(wt2, verbose=True) |
2296.1.1
by Martin Pool
Make tests for truncation of status output more robust on wide terminals. |
180 |
self.assertStartsWith(message, "pending merges:\n") |
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
181 |
self.assert_("Empty commit 3" in message) |
2296.1.1
by Martin Pool
Make tests for truncation of status output more robust on wide terminals. |
182 |
self.assertEndsWith(message, "...\n") |
1185.12.27
by Aaron Bentley
Use line log for pending merges |
183 |
|
2255.7.97
by Robert Collins
Teach delta.report_changes about unversioned files, removing all inventory access during status --short. |
184 |
def test_tree_status_ignores(self): |
185 |
"""Tests branch status with ignores"""
|
|
186 |
wt = self.make_branch_and_tree('.') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
187 |
self.run_bzr('ignore *~') |
2255.7.97
by Robert Collins
Teach delta.report_changes about unversioned files, removing all inventory access during status --short. |
188 |
wt.commit('commit .bzrignore') |
189 |
self.build_tree(['foo.c', 'foo.c~']) |
|
190 |
self.assertStatus([ |
|
191 |
'unknown:\n', |
|
192 |
' foo.c\n', |
|
193 |
],
|
|
194 |
wt) |
|
195 |
self.assertStatus([ |
|
196 |
'? foo.c\n', |
|
197 |
],
|
|
198 |
wt, short=True) |
|
199 |
||
200 |
def test_tree_status_specific_files(self): |
|
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
201 |
"""Tests branch status with given specific files"""
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
202 |
wt = self.make_branch_and_tree('.') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
203 |
b = wt.branch |
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
204 |
|
205 |
self.build_tree(['directory/','directory/hello.c', 'bye.c','test.c','dir2/']) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
206 |
wt.add('directory') |
207 |
wt.add('test.c') |
|
208 |
wt.commit('testing') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
209 |
|
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
210 |
self.assertStatus([ |
211 |
'unknown:\n', |
|
212 |
' bye.c\n', |
|
2255.7.91
by Robert Collins
Move unknown detection in long status into the delta creation, saving a tree-scan. |
213 |
' dir2/\n', |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
214 |
' directory/hello.c\n' |
215 |
],
|
|
216 |
wt) |
|
217 |
||
218 |
self.assertStatus([ |
|
1551.10.7
by Aaron Bentley
Use new-style output for status |
219 |
'? bye.c\n', |
2255.7.97
by Robert Collins
Teach delta.report_changes about unversioned files, removing all inventory access during status --short. |
220 |
'? dir2/\n', |
1551.10.7
by Aaron Bentley
Use new-style output for status |
221 |
'? directory/hello.c\n' |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
222 |
],
|
223 |
wt, short=True) |
|
224 |
||
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
225 |
tof = StringIO() |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
226 |
self.assertRaises(errors.PathsDoNotExist, |
227 |
show_tree_status, |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
228 |
wt, specific_files=['bye.c','test.c','absent.c'], |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
229 |
to_file=tof) |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
230 |
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
231 |
tof = StringIO() |
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
232 |
show_tree_status(wt, specific_files=['directory'], to_file=tof) |
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
233 |
tof.seek(0) |
234 |
self.assertEquals(tof.readlines(), |
|
235 |
['unknown:\n', |
|
236 |
' directory/hello.c\n' |
|
237 |
])
|
|
238 |
tof = StringIO() |
|
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
239 |
show_tree_status(wt, specific_files=['directory'], to_file=tof, |
240 |
short=True) |
|
241 |
tof.seek(0) |
|
1551.10.7
by Aaron Bentley
Use new-style output for status |
242 |
self.assertEquals(tof.readlines(), ['? directory/hello.c\n']) |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
243 |
|
244 |
tof = StringIO() |
|
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
245 |
show_tree_status(wt, specific_files=['dir2'], to_file=tof) |
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
246 |
tof.seek(0) |
247 |
self.assertEquals(tof.readlines(), |
|
248 |
['unknown:\n', |
|
2255.7.91
by Robert Collins
Move unknown detection in long status into the delta creation, saving a tree-scan. |
249 |
' dir2/\n' |
1399
by Robert Collins
Patch from Heikki Paajanen testing status on specific files |
250 |
])
|
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
251 |
tof = StringIO() |
252 |
show_tree_status(wt, specific_files=['dir2'], to_file=tof, short=True) |
|
253 |
tof.seek(0) |
|
2255.7.97
by Robert Collins
Teach delta.report_changes about unversioned files, removing all inventory access during status --short. |
254 |
self.assertEquals(tof.readlines(), ['? dir2/\n']) |
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
255 |
|
2748.2.1
by Lukáš Lalinsky
Return ConflictsList() instead of [] from Tree.conflicts. |
256 |
tof = StringIO() |
257 |
revs = [RevisionSpec.from_string('0'), RevisionSpec.from_string('1')] |
|
2761.1.2
by Aaron Bentley
Fix line wrapping |
258 |
show_tree_status(wt, specific_files=['test.c'], to_file=tof, |
259 |
short=True, revision=revs) |
|
2748.2.1
by Lukáš Lalinsky
Return ConflictsList() instead of [] from Tree.conflicts. |
260 |
tof.seek(0) |
261 |
self.assertEquals(tof.readlines(), ['+N test.c\n']) |
|
262 |
||
1551.15.58
by Aaron Bentley
Status honours selected paths for conflicts (#127606) |
263 |
def test_specific_files_conflicts(self): |
264 |
tree = self.make_branch_and_tree('.') |
|
265 |
self.build_tree(['dir2/']) |
|
266 |
tree.add('dir2') |
|
267 |
tree.commit('added dir2') |
|
268 |
tree.set_conflicts(conflicts.ConflictList( |
|
269 |
[conflicts.ContentsConflict('foo')])) |
|
270 |
tof = StringIO() |
|
271 |
show_tree_status(tree, specific_files=['dir2'], to_file=tof) |
|
272 |
self.assertEqualDiff('', tof.getvalue()) |
|
273 |
tree.set_conflicts(conflicts.ConflictList( |
|
274 |
[conflicts.ContentsConflict('dir2')])) |
|
275 |
tof = StringIO() |
|
276 |
show_tree_status(tree, specific_files=['dir2'], to_file=tof) |
|
277 |
self.assertEqualDiff('conflicts:\n Contents conflict in dir2\n', |
|
278 |
tof.getvalue()) |
|
279 |
||
280 |
tree.set_conflicts(conflicts.ConflictList( |
|
281 |
[conflicts.ContentsConflict('dir2/file1')])) |
|
282 |
tof = StringIO() |
|
283 |
show_tree_status(tree, specific_files=['dir2'], to_file=tof) |
|
284 |
self.assertEqualDiff('conflicts:\n Contents conflict in dir2/file1\n', |
|
285 |
tof.getvalue()) |
|
286 |
||
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
287 |
def _prepare_nonexistent(self): |
1662.1.9
by Martin Pool
Give a clear error for bzr status of an unversioned, nonexistent file. (Malone #3619) |
288 |
wt = self.make_branch_and_tree('.') |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
289 |
self.assertStatus([], wt) |
290 |
self.build_tree(['FILE_A', 'FILE_B', 'FILE_C', 'FILE_D', 'FILE_E', ]) |
|
291 |
wt.add('FILE_A') |
|
292 |
wt.add('FILE_B') |
|
293 |
wt.add('FILE_C') |
|
294 |
wt.add('FILE_D') |
|
295 |
wt.add('FILE_E') |
|
296 |
wt.commit('Create five empty files.') |
|
297 |
open('FILE_B', 'w').write('Modification to file FILE_B.') |
|
298 |
open('FILE_C', 'w').write('Modification to file FILE_C.') |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
299 |
unlink('FILE_E') # FILE_E will be versioned but missing |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
300 |
open('FILE_Q', 'w').write('FILE_Q is added but not committed.') |
301 |
wt.add('FILE_Q') # FILE_Q will be added but not committed |
|
302 |
open('UNVERSIONED_BUT_EXISTING', 'w') |
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
303 |
return wt |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
304 |
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
305 |
def test_status_nonexistent_file(self): |
306 |
# files that don't exist in either the basis tree or working tree
|
|
307 |
# should give an error
|
|
308 |
wt = self._prepare_nonexistent() |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
309 |
self.assertStatus([ |
310 |
'removed:\n', |
|
311 |
' FILE_E\n', |
|
312 |
'added:\n', |
|
313 |
' FILE_Q\n', |
|
314 |
'modified:\n', |
|
315 |
' FILE_B\n', |
|
316 |
' FILE_C\n', |
|
317 |
'unknown:\n', |
|
318 |
' UNVERSIONED_BUT_EXISTING\n', |
|
319 |
],
|
|
320 |
wt) |
|
321 |
self.assertStatus([ |
|
322 |
' M FILE_B\n', |
|
323 |
' M FILE_C\n', |
|
324 |
' D FILE_E\n', |
|
325 |
'+N FILE_Q\n', |
|
326 |
'? UNVERSIONED_BUT_EXISTING\n', |
|
327 |
],
|
|
328 |
wt, short=True) |
|
329 |
||
330 |
# Okay, everything's looking good with the existent files.
|
|
331 |
# Let's see what happens when we throw in non-existent files.
|
|
332 |
||
333 |
# bzr st [--short] NONEXISTENT '
|
|
334 |
expected = [ |
|
335 |
'nonexistent:\n', |
|
336 |
' NONEXISTENT\n', |
|
337 |
]
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
338 |
out, err = self.run_bzr('status NONEXISTENT', retcode=3) |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
339 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
340 |
self.assertContainsRe(err, |
341 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
342 |
'NONEXISTENT.*') |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
343 |
expected = [ |
344 |
'X: NONEXISTENT\n', |
|
345 |
]
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
346 |
out, err = self.run_bzr('status --short NONEXISTENT', retcode=3) |
347 |
self.assertContainsRe(err, |
|
348 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
349 |
'NONEXISTENT.*') |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
350 |
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
351 |
def test_status_nonexistent_file_with_others(self): |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
352 |
# bzr st [--short] NONEXISTENT ...others..
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
353 |
wt = self._prepare_nonexistent() |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
354 |
expected = [ |
355 |
'removed:\n', |
|
356 |
' FILE_E\n', |
|
357 |
'modified:\n', |
|
358 |
' FILE_B\n', |
|
359 |
' FILE_C\n', |
|
360 |
'nonexistent:\n', |
|
361 |
' NONEXISTENT\n', |
|
362 |
]
|
|
363 |
out, err = self.run_bzr('status NONEXISTENT ' |
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
364 |
'FILE_A FILE_B FILE_C FILE_D FILE_E', |
365 |
retcode=3) |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
366 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
367 |
self.assertContainsRe(err, |
368 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
369 |
'NONEXISTENT.*') |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
370 |
expected = [ |
371 |
' D FILE_E\n', |
|
372 |
' M FILE_C\n', |
|
373 |
' M FILE_B\n', |
|
374 |
'X NONEXISTENT\n', |
|
375 |
]
|
|
376 |
out, err = self.run_bzr('status --short NONEXISTENT ' |
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
377 |
'FILE_A FILE_B FILE_C FILE_D FILE_E', |
378 |
retcode=3) |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
379 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
380 |
self.assertContainsRe(err, |
381 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
382 |
'NONEXISTENT.*') |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
383 |
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
384 |
def test_status_multiple_nonexistent_files(self): |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
385 |
# bzr st [--short] NONEXISTENT ... ANOTHER_NONEXISTENT ...
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
386 |
wt = self._prepare_nonexistent() |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
387 |
expected = [ |
388 |
'removed:\n', |
|
389 |
' FILE_E\n', |
|
390 |
'modified:\n', |
|
391 |
' FILE_B\n', |
|
392 |
' FILE_C\n', |
|
393 |
'nonexistent:\n', |
|
394 |
' ANOTHER_NONEXISTENT\n', |
|
395 |
' NONEXISTENT\n', |
|
396 |
]
|
|
397 |
out, err = self.run_bzr('status NONEXISTENT ' |
|
398 |
'FILE_A FILE_B ANOTHER_NONEXISTENT '
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
399 |
'FILE_C FILE_D FILE_E', retcode=3) |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
400 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
401 |
self.assertContainsRe(err, |
402 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
403 |
'ANOTHER_NONEXISTENT NONEXISTENT.*') |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
404 |
expected = [ |
405 |
' D FILE_E\n', |
|
406 |
' M FILE_C\n', |
|
407 |
' M FILE_B\n', |
|
408 |
'X ANOTHER_NONEXISTENT\n', |
|
409 |
'X NONEXISTENT\n', |
|
410 |
]
|
|
411 |
out, err = self.run_bzr('status --short NONEXISTENT ' |
|
412 |
'FILE_A FILE_B ANOTHER_NONEXISTENT '
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
413 |
'FILE_C FILE_D FILE_E', retcode=3) |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
414 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
415 |
self.assertContainsRe(err, |
416 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
417 |
'ANOTHER_NONEXISTENT NONEXISTENT.*') |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
418 |
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
419 |
def test_status_nonexistent_file_with_unversioned(self): |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
420 |
# bzr st [--short] NONEXISTENT A B UNVERSIONED_BUT_EXISTING C D E Q
|
3930.2.17
by Ian Clatworthy
split tests as suggested by Jelmer's review |
421 |
wt = self._prepare_nonexistent() |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
422 |
expected = [ |
423 |
'removed:\n', |
|
424 |
' FILE_E\n', |
|
425 |
'added:\n', |
|
426 |
' FILE_Q\n', |
|
427 |
'modified:\n', |
|
428 |
' FILE_B\n', |
|
429 |
' FILE_C\n', |
|
430 |
'unknown:\n', |
|
431 |
' UNVERSIONED_BUT_EXISTING\n', |
|
432 |
'nonexistent:\n', |
|
433 |
' NONEXISTENT\n', |
|
434 |
]
|
|
435 |
out, err = self.run_bzr('status NONEXISTENT ' |
|
436 |
'FILE_A FILE_B UNVERSIONED_BUT_EXISTING '
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
437 |
'FILE_C FILE_D FILE_E FILE_Q', retcode=3) |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
438 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
439 |
self.assertContainsRe(err, |
440 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
441 |
'NONEXISTENT.*') |
|
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
442 |
expected = [ |
443 |
'+N FILE_Q\n', |
|
444 |
'? UNVERSIONED_BUT_EXISTING\n', |
|
445 |
' D FILE_E\n', |
|
446 |
' M FILE_C\n', |
|
447 |
' M FILE_B\n', |
|
448 |
'X NONEXISTENT\n', |
|
449 |
]
|
|
450 |
out, err = self.run_bzr('status --short NONEXISTENT ' |
|
451 |
'FILE_A FILE_B UNVERSIONED_BUT_EXISTING '
|
|
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
452 |
'FILE_C FILE_D FILE_E FILE_Q', retcode=3) |
3930.2.12
by Karl Fogel
Part of bug #306394: Add regression tests. |
453 |
self.assertEqual(expected, out.splitlines(True)) |
3930.2.13
by Karl Fogel
Part of bug #306394: Raise an error (code 3) when status is invoked on |
454 |
self.assertContainsRe(err, |
455 |
r'.*ERROR: Path\(s\) do not exist: ' |
|
456 |
'NONEXISTENT.*') |
|
1662.1.9
by Martin Pool
Give a clear error for bzr status of an unversioned, nonexistent file. (Malone #3619) |
457 |
|
2091.4.2
by wang
add tests for "diff" and "status" |
458 |
def test_status_out_of_date(self): |
459 |
"""Simulate status of out-of-date tree after remote push"""
|
|
460 |
tree = self.make_branch_and_tree('.') |
|
461 |
self.build_tree_contents([('a', 'foo\n')]) |
|
462 |
tree.lock_write() |
|
463 |
try: |
|
464 |
tree.add(['a']) |
|
465 |
tree.commit('add test file') |
|
466 |
# simulate what happens after a remote push
|
|
467 |
tree.set_last_revision("0") |
|
468 |
finally: |
|
2408.1.7
by Alexander Belchenko
Fix blackbox test_status_out_of_date: unlock WT before next command running |
469 |
# before run another commands we should unlock tree
|
2091.4.2
by wang
add tests for "diff" and "status" |
470 |
tree.unlock() |
2408.1.7
by Alexander Belchenko
Fix blackbox test_status_out_of_date: unlock WT before next command running |
471 |
out, err = self.run_bzr('status') |
472 |
self.assertEqual("working tree is out of date, run 'bzr update'\n", |
|
473 |
err) |
|
2091.4.2
by wang
add tests for "diff" and "status" |
474 |
|
3655.3.1
by Lukáš Lalinský
Fix `bzr st -rbranch:PATH_TO_BRANCH` |
475 |
def test_status_write_lock(self): |
3732.1.1
by Ian Clatworthy
fix bzr st -rbranch:path-to-branch (Lukas Lalinsky) |
476 |
"""Test that status works without fetching history and
|
3655.3.1
by Lukáš Lalinský
Fix `bzr st -rbranch:PATH_TO_BRANCH` |
477 |
having a write lock.
|
478 |
||
479 |
See https://bugs.launchpad.net/bzr/+bug/149270
|
|
480 |
"""
|
|
481 |
mkdir('branch1') |
|
482 |
wt = self.make_branch_and_tree('branch1') |
|
483 |
b = wt.branch |
|
484 |
wt.commit('Empty commit 1') |
|
485 |
wt2 = b.bzrdir.sprout('branch2').open_workingtree() |
|
3732.1.1
by Ian Clatworthy
fix bzr st -rbranch:path-to-branch (Lukas Lalinsky) |
486 |
wt2.commit('Empty commit 2') |
3655.3.1
by Lukáš Lalinský
Fix `bzr st -rbranch:PATH_TO_BRANCH` |
487 |
out, err = self.run_bzr('status branch1 -rbranch:branch2') |
488 |
self.assertEqual('', out) |
|
489 |
||
1662.1.9
by Martin Pool
Give a clear error for bzr status of an unversioned, nonexistent file. (Malone #3619) |
490 |
|
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
491 |
class CheckoutStatus(BranchStatus): |
1551.2.12
by Aaron Bentley
whitespace fixups |
492 |
|
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
493 |
def setUp(self): |
494 |
super(CheckoutStatus, self).setUp() |
|
495 |
mkdir('codir') |
|
496 |
chdir('codir') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
497 |
|
1551.2.9
by Aaron Bentley
Fix status to work with checkouts |
498 |
def make_branch_and_tree(self, relpath): |
499 |
source = self.make_branch(pathjoin('..', relpath)) |
|
500 |
checkout = bzrdir.BzrDirMetaFormat1().initialize(relpath) |
|
501 |
bzrlib.branch.BranchReferenceFormat().initialize(checkout, source) |
|
502 |
return checkout.create_workingtree() |
|
503 |
||
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
504 |
|
1534.4.54
by Robert Collins
Merge from integration. |
505 |
class TestStatus(TestCaseWithTransport): |
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
506 |
|
2318.2.1
by Kent Gibson
Apply status versioned patch |
507 |
def test_status_plain(self): |
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
508 |
tree = self.make_branch_and_tree('.') |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
509 |
|
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
510 |
self.build_tree(['hello.txt']) |
511 |
result = self.run_bzr("status")[0] |
|
2318.2.1
by Kent Gibson
Apply status versioned patch |
512 |
self.assertContainsRe(result, "unknown:\n hello.txt\n") |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
513 |
|
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
514 |
tree.add("hello.txt") |
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
515 |
result = self.run_bzr("status")[0] |
1551.10.7
by Aaron Bentley
Use new-style output for status |
516 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
517 |
|
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
518 |
tree.commit(message="added") |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
519 |
result = self.run_bzr("status -r 0..1")[0] |
1551.10.7
by Aaron Bentley
Use new-style output for status |
520 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
521 |
|
2745.4.3
by Lukáš Lalinsky
Change -C to -c. |
522 |
result = self.run_bzr("status -c 1")[0] |
2745.4.1
by Lukáš Lalinsky
New option -C/--change for diff and status to show changes in one revision. (#56299) |
523 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
524 |
||
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
525 |
self.build_tree(['world.txt']) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
526 |
result = self.run_bzr("status -r 0")[0] |
1551.10.7
by Aaron Bentley
Use new-style output for status |
527 |
self.assertContainsRe(result, "added:\n hello.txt\n" \ |
528 |
"unknown:\n world.txt\n") |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
529 |
result2 = self.run_bzr("status -r 0..")[0] |
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
530 |
self.assertEquals(result2, result) |
2318.2.1
by Kent Gibson
Apply status versioned patch |
531 |
|
532 |
def test_status_short(self): |
|
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
533 |
tree = self.make_branch_and_tree('.') |
2318.2.1
by Kent Gibson
Apply status versioned patch |
534 |
|
535 |
self.build_tree(['hello.txt']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
536 |
result = self.run_bzr("status --short")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
537 |
self.assertContainsRe(result, "[?] hello.txt\n") |
538 |
||
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
539 |
tree.add("hello.txt") |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
540 |
result = self.run_bzr("status --short")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
541 |
self.assertContainsRe(result, "[+]N hello.txt\n") |
542 |
||
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
543 |
tree.commit(message="added") |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
544 |
result = self.run_bzr("status --short -r 0..1")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
545 |
self.assertContainsRe(result, "[+]N hello.txt\n") |
546 |
||
547 |
self.build_tree(['world.txt']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
548 |
result = self.run_bzr("status --short -r 0")[0] |
1551.10.7
by Aaron Bentley
Use new-style output for status |
549 |
self.assertContainsRe(result, "[+]N hello.txt\n" \ |
550 |
"[?] world.txt\n") |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
551 |
result2 = self.run_bzr("status --short -r 0..")[0] |
2147.2.2
by Keir Mierle
Fix spacing error and add tests for status --short command flag. |
552 |
self.assertEquals(result2, result) |
1185.50.69
by John Arbash Meinel
[merge] bzr.robey, small fixes (--lsprof-file, log, status, http parsing, parmiko) |
553 |
|
2318.2.1
by Kent Gibson
Apply status versioned patch |
554 |
def test_status_versioned(self): |
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
555 |
tree = self.make_branch_and_tree('.') |
2318.2.1
by Kent Gibson
Apply status versioned patch |
556 |
|
557 |
self.build_tree(['hello.txt']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
558 |
result = self.run_bzr("status --versioned")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
559 |
self.assertNotContainsRe(result, "unknown:\n hello.txt\n") |
560 |
||
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
561 |
tree.add("hello.txt") |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
562 |
result = self.run_bzr("status --versioned")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
563 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
564 |
||
2664.7.1
by Daniel Watkins
tests.blackbox.test_status now uses internals where appropriate. |
565 |
tree.commit("added") |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
566 |
result = self.run_bzr("status --versioned -r 0..1")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
567 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
568 |
||
569 |
self.build_tree(['world.txt']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
570 |
result = self.run_bzr("status --versioned -r 0")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
571 |
self.assertContainsRe(result, "added:\n hello.txt\n") |
572 |
self.assertNotContainsRe(result, "unknown:\n world.txt\n") |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
573 |
result2 = self.run_bzr("status --versioned -r 0..")[0] |
2318.2.1
by Kent Gibson
Apply status versioned patch |
574 |
self.assertEquals(result2, result) |
575 |
||
2663.1.7
by Daniel Watkins
Capitalised short names. |
576 |
def test_status_SV(self): |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
577 |
tree = self.make_branch_and_tree('.') |
578 |
||
579 |
self.build_tree(['hello.txt']) |
|
2663.1.7
by Daniel Watkins
Capitalised short names. |
580 |
result = self.run_bzr("status -SV")[0] |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
581 |
self.assertNotContainsRe(result, "hello.txt") |
582 |
||
583 |
tree.add("hello.txt") |
|
2663.1.7
by Daniel Watkins
Capitalised short names. |
584 |
result = self.run_bzr("status -SV")[0] |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
585 |
self.assertContainsRe(result, "[+]N hello.txt\n") |
586 |
||
587 |
tree.commit(message="added") |
|
2663.1.7
by Daniel Watkins
Capitalised short names. |
588 |
result = self.run_bzr("status -SV -r 0..1")[0] |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
589 |
self.assertContainsRe(result, "[+]N hello.txt\n") |
590 |
||
591 |
self.build_tree(['world.txt']) |
|
2663.1.7
by Daniel Watkins
Capitalised short names. |
592 |
result = self.run_bzr("status -SV -r 0")[0] |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
593 |
self.assertContainsRe(result, "[+]N hello.txt\n") |
594 |
||
2663.1.7
by Daniel Watkins
Capitalised short names. |
595 |
result2 = self.run_bzr("status -SV -r 0..")[0] |
2663.1.3
by Daniel Watkins
Added test for 'status --quiet'. |
596 |
self.assertEquals(result2, result) |
597 |
||
1551.10.9
by Aaron Bentley
Add test cases for status with kind change |
598 |
def assertStatusContains(self, pattern): |
599 |
"""Run status, and assert it contains the given pattern"""
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
600 |
result = self.run_bzr("status --short")[0] |
1551.10.9
by Aaron Bentley
Add test cases for status with kind change |
601 |
self.assertContainsRe(result, pattern) |
602 |
||
603 |
def test_kind_change_short(self): |
|
604 |
tree = self.make_branch_and_tree('.') |
|
605 |
self.build_tree(['file']) |
|
606 |
tree.add('file') |
|
607 |
tree.commit('added file') |
|
608 |
unlink('file') |
|
609 |
self.build_tree(['file/']) |
|
610 |
self.assertStatusContains('K file => file/') |
|
611 |
tree.rename_one('file', 'directory') |
|
612 |
self.assertStatusContains('RK file => directory/') |
|
613 |
rmdir('directory') |
|
614 |
self.assertStatusContains('RD file => directory') |
|
615 |
||
2745.4.1
by Lukáš Lalinsky
New option -C/--change for diff and status to show changes in one revision. (#56299) |
616 |
def test_status_illegal_revision_specifiers(self): |
617 |
out, err = self.run_bzr('status -r 1..23..123', retcode=3) |
|
618 |
self.assertContainsRe(err, 'one or two revision specifiers') |
|
619 |
||
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
620 |
def test_status_no_pending(self): |
621 |
a_tree = self.make_branch_and_tree('a') |
|
622 |
self.build_tree(['a/a']) |
|
623 |
a_tree.add('a') |
|
624 |
a_tree.commit('a') |
|
625 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
|
626 |
self.build_tree(['b/b']) |
|
627 |
b_tree.add('b') |
|
628 |
b_tree.commit('b') |
|
629 |
||
3585.2.1
by Robert Collins
Create acceptance test for bug 150438. |
630 |
self.run_bzr('merge ../b', working_dir='a') |
631 |
out, err = self.run_bzr('status --no-pending', working_dir='a') |
|
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
632 |
self.assertEquals(out, "added:\n b\n") |
633 |
||
3636.1.1
by Robert Collins
Stop passing specific_file lists to show_tree_status when the specific |
634 |
def test_pending_specific_files(self): |
635 |
"""With a specific file list, pending merges are not shown."""
|
|
636 |
tree = self.make_branch_and_tree('tree') |
|
637 |
self.build_tree_contents([('tree/a', 'content of a\n')]) |
|
638 |
tree.add('a') |
|
639 |
r1_id = tree.commit('one') |
|
640 |
alt = tree.bzrdir.sprout('alt').open_workingtree() |
|
641 |
self.build_tree_contents([('alt/a', 'content of a\nfrom alt\n')]) |
|
642 |
alt_id = alt.commit('alt') |
|
643 |
tree.merge_from_branch(alt.branch) |
|
3655.2.1
by Lukáš Lalinský
Fix test_pending_specific_files |
644 |
output = self.make_utf8_encoded_stringio() |
3636.1.1
by Robert Collins
Stop passing specific_file lists to show_tree_status when the specific |
645 |
show_tree_status(tree, to_file=output) |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
646 |
self.assertContainsRe(output.getvalue(), 'pending merge') |
3636.1.1
by Robert Collins
Stop passing specific_file lists to show_tree_status when the specific |
647 |
out, err = self.run_bzr('status tree/a') |
3936.2.1
by Ian Clatworthy
verbose flag for status - code & tests |
648 |
self.assertNotContainsRe(out, 'pending merge') |
3636.1.1
by Robert Collins
Stop passing specific_file lists to show_tree_status when the specific |
649 |
|
3270.6.1
by James Westby
Add --no-pending to status to not show the pending merges. (#202830) |
650 |
|
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
651 |
class TestStatusEncodings(TestCaseWithTransport): |
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
652 |
|
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
653 |
def setUp(self): |
654 |
TestCaseWithTransport.setUp(self) |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
655 |
self.user_encoding = osutils._cached_user_encoding |
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
656 |
self.stdout = sys.stdout |
657 |
||
658 |
def tearDown(self): |
|
4423.1.1
by Alexander Belchenko
Remove users of bzrlib.user_encoding |
659 |
osutils._cached_user_encoding = self.user_encoding |
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
660 |
sys.stdout = self.stdout |
661 |
TestCaseWithTransport.tearDown(self) |
|
662 |
||
663 |
def make_uncommitted_tree(self): |
|
664 |
"""Build a branch with uncommitted unicode named changes in the cwd."""
|
|
665 |
working_tree = self.make_branch_and_tree(u'.') |
|
666 |
filename = u'hell\u00d8' |
|
667 |
try: |
|
668 |
self.build_tree_contents([(filename, 'contents of hello')]) |
|
669 |
except UnicodeEncodeError: |
|
670 |
raise TestSkipped("can't build unicode working tree in " |
|
671 |
"filesystem encoding %s" % sys.getfilesystemencoding()) |
|
672 |
working_tree.add(filename) |
|
673 |
return working_tree |
|
674 |
||
675 |
def test_stdout_ascii(self): |
|
676 |
sys.stdout = StringIO() |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
677 |
osutils._cached_user_encoding = 'ascii' |
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
678 |
working_tree = self.make_uncommitted_tree() |
679 |
stdout, stderr = self.run_bzr("status") |
|
680 |
||
681 |
self.assertEquals(stdout, """\ |
|
682 |
added:
|
|
683 |
hell?
|
|
684 |
""") |
|
685 |
||
686 |
def test_stdout_latin1(self): |
|
687 |
sys.stdout = StringIO() |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
688 |
osutils._cached_user_encoding = 'latin-1' |
1685.1.6
by John Arbash Meinel
Merged test_status.py.moved into test_status.py |
689 |
working_tree = self.make_uncommitted_tree() |
690 |
stdout, stderr = self.run_bzr('status') |
|
691 |
||
692 |
self.assertEquals(stdout, u"""\ |
|
693 |
added:
|
|
694 |
hell\u00d8 |
|
695 |
""".encode('latin-1')) |
|
696 |