bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5557.1.7
by John Arbash Meinel
Merge in the bzr.dev 5582 |
1 |
# Copyright (C) 2005-2011 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1185.14.8
by Aaron Bentley
Added test_commit.py |
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 |
#
|
1185.14.8
by Aaron Bentley
Added test_commit.py |
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 |
#
|
1185.14.8
by Aaron Bentley
Added test_commit.py |
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
|
1185.14.8
by Aaron Bentley
Added test_commit.py |
16 |
|
17 |
import os |
|
18 |
||
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
19 |
from .. import ( |
4597.2.2
by Vincent Ladeuil
Cleanup conflict tests. |
20 |
conflicts, |
21 |
errors, |
|
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
22 |
option, |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
23 |
osutils, |
4597.2.2
by Vincent Ladeuil
Cleanup conflict tests. |
24 |
tests, |
7490.69.1
by Jelmer Vernooij
Move some more tests to breezy.bzr. |
25 |
transform, |
4597.2.2
by Vincent Ladeuil
Cleanup conflict tests. |
26 |
)
|
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
27 |
from ..bzr import conflicts as bzr_conflicts |
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
28 |
from . import ( |
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
29 |
script, |
30 |
scenarios, |
|
31 |
)
|
|
32 |
||
33 |
||
34 |
load_tests = scenarios.load_tests_apply_scenarios |
|
4597.2.26
by Vincent Ladeuil
Fix bug #529968 by renaming the kept file on content conflicts. |
35 |
|
36 |
||
1185.14.8
by Aaron Bentley
Added test_commit.py |
37 |
# TODO: Test commit with some added, and added-but-missing files
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
38 |
# RBC 20060124 is that not tested in test_commit.py ?
|
1185.14.8
by Aaron Bentley
Added test_commit.py |
39 |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
40 |
# The order of 'path' here is important - do not let it
|
41 |
# be a sorted list.
|
|
2309.4.13
by John Arbash Meinel
Conflicts go through Stanza so the need to be aware of utf8 versus unicode file ids. |
42 |
# u'\xe5' == a with circle
|
43 |
# '\xc3\xae' == u'\xee' == i with hat
|
|
4597.2.2
by Vincent Ladeuil
Cleanup conflict tests. |
44 |
# So these are u'path' and 'id' only with a circle and a hat. (shappo?)
|
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
45 |
example_conflicts = [ |
46 |
bzr_conflicts.MissingParent('Not deleting', u'p\xe5thg', b'\xc3\xaedg'), |
|
47 |
bzr_conflicts.ContentsConflict(u'p\xe5tha', None, b'\xc3\xaeda'), |
|
48 |
bzr_conflicts.TextConflict(u'p\xe5tha'), |
|
49 |
bzr_conflicts.PathConflict(u'p\xe5thb', u'p\xe5thc', b'\xc3\xaedb'), |
|
50 |
bzr_conflicts.DuplicateID('Unversioned existing file', |
|
51 |
u'p\xe5thc', u'p\xe5thc2', |
|
52 |
b'\xc3\xaedc', b'\xc3\xaedc'), |
|
53 |
bzr_conflicts.DuplicateEntry('Moved existing file to', |
|
54 |
u'p\xe5thdd.moved', u'p\xe5thd', |
|
55 |
b'\xc3\xaedd', None), |
|
56 |
bzr_conflicts.ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e', |
|
57 |
None, b'\xc3\xaed2e'), |
|
58 |
bzr_conflicts.UnversionedParent('Versioned directory', |
|
59 |
u'p\xe5thf', b'\xc3\xaedf'), |
|
60 |
bzr_conflicts.NonDirectoryParent('Created directory', |
|
61 |
u'p\xe5thg', b'\xc3\xaedg'), |
|
62 |
]
|
|
1534.10.4
by Aaron Bentley
Implemented conflict serialization |
63 |
|
64 |
||
5898.1.1
by Martin
Refactor conflict stanzas tests to use scenarios |
65 |
def vary_by_conflicts(): |
66 |
for conflict in example_conflicts: |
|
67 |
yield (conflict.__class__.__name__, {"conflict": conflict}) |
|
68 |
||
69 |
||
4597.2.2
by Vincent Ladeuil
Cleanup conflict tests. |
70 |
class TestConflicts(tests.TestCaseWithTransport): |
1185.14.8
by Aaron Bentley
Added test_commit.py |
71 |
|
1558.12.9
by Aaron Bentley
Handle resolving conflicts with directories properly |
72 |
def test_resolve_conflict_dir(self): |
73 |
tree = self.make_branch_and_tree('.') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
74 |
self.build_tree_contents([('hello', b'hello world4'), |
75 |
('hello.THIS', b'hello world2'), |
|
76 |
('hello.BASE', b'hello world1'), |
|
4597.2.3
by Vincent Ladeuil
More cleanup. |
77 |
])
|
78 |
os.mkdir('hello.OTHER') |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
79 |
tree.add('hello', b'q') |
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
80 |
l = conflicts.ConflictList([bzr_conflicts.TextConflict('hello')]) |
1558.12.9
by Aaron Bentley
Handle resolving conflicts with directories properly |
81 |
l.remove_files(tree) |
82 |
||
1551.15.58
by Aaron Bentley
Status honours selected paths for conflicts (#127606) |
83 |
def test_select_conflicts(self): |
84 |
tree = self.make_branch_and_tree('.') |
|
4597.2.3
by Vincent Ladeuil
More cleanup. |
85 |
clist = conflicts.ConflictList |
86 |
||
87 |
def check_select(not_selected, selected, paths, **kwargs): |
|
88 |
self.assertEqual( |
|
89 |
(not_selected, selected), |
|
90 |
tree_conflicts.select_conflicts(tree, paths, **kwargs)) |
|
91 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
92 |
foo = bzr_conflicts.ContentsConflict('foo') |
93 |
bar = bzr_conflicts.ContentsConflict('bar') |
|
4597.2.3
by Vincent Ladeuil
More cleanup. |
94 |
tree_conflicts = clist([foo, bar]) |
95 |
||
96 |
check_select(clist([bar]), clist([foo]), ['foo']) |
|
97 |
check_select(clist(), tree_conflicts, |
|
98 |
[''], ignore_misses=True, recurse=True) |
|
99 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
100 |
foobaz = bzr_conflicts.ContentsConflict('foo/baz') |
4597.2.3
by Vincent Ladeuil
More cleanup. |
101 |
tree_conflicts = clist([foobaz, bar]) |
102 |
||
103 |
check_select(clist([bar]), clist([foobaz]), |
|
104 |
['foo'], ignore_misses=True, recurse=True) |
|
105 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
106 |
qux = bzr_conflicts.PathConflict('qux', 'foo/baz') |
4597.2.3
by Vincent Ladeuil
More cleanup. |
107 |
tree_conflicts = clist([qux]) |
108 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
109 |
check_select(tree_conflicts, clist(), |
4597.2.3
by Vincent Ladeuil
More cleanup. |
110 |
['foo'], ignore_misses=True, recurse=True) |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
111 |
check_select(tree_conflicts, clist(), ['foo'], ignore_misses=True) |
1551.15.58
by Aaron Bentley
Status honours selected paths for conflicts (#127606) |
112 |
|
3017.2.1
by Aaron Bentley
Revert now resolves conflicts recursively (#102739) |
113 |
def test_resolve_conflicts_recursive(self): |
114 |
tree = self.make_branch_and_tree('.') |
|
115 |
self.build_tree(['dir/', 'dir/hello']) |
|
116 |
tree.add(['dir', 'dir/hello']) |
|
4597.2.3
by Vincent Ladeuil
More cleanup. |
117 |
|
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
118 |
dirhello = [bzr_conflicts.TextConflict('dir/hello')] |
4597.2.3
by Vincent Ladeuil
More cleanup. |
119 |
tree.set_conflicts(dirhello) |
120 |
||
121 |
conflicts.resolve(tree, ['dir'], recursive=False, ignore_misses=True) |
|
122 |
self.assertEqual(dirhello, tree.conflicts()) |
|
123 |
||
124 |
conflicts.resolve(tree, ['dir'], recursive=True, ignore_misses=True) |
|
125 |
self.assertEqual(conflicts.ConflictList([]), tree.conflicts()) |
|
4773.1.1
by Vincent Ladeuil
Cleanup imports in test_conflicts |
126 |
|
127 |
||
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
128 |
class TestPerConflict(tests.TestCase): |
4597.3.43
by Vincent Ladeuil
Cleanups, ready to record. |
129 |
|
5898.1.1
by Martin
Refactor conflict stanzas tests to use scenarios |
130 |
scenarios = scenarios.multiply_scenarios(vary_by_conflicts()) |
131 |
||
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
132 |
def test_stringification(self): |
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
133 |
text = str(self.conflict) |
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
134 |
self.assertContainsString(text, self.conflict.path) |
135 |
self.assertContainsString(text.lower(), "conflict") |
|
136 |
self.assertContainsString(repr(self.conflict), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
137 |
self.conflict.__class__.__name__) |
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
138 |
|
5898.1.1
by Martin
Refactor conflict stanzas tests to use scenarios |
139 |
|
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
140 |
class TestConflictList(tests.TestCase): |
5898.1.1
by Martin
Refactor conflict stanzas tests to use scenarios |
141 |
|
142 |
def test_stanzas_roundtrip(self): |
|
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
143 |
stanzas_iter = bzr_conflicts.ConflictList(example_conflicts).to_stanzas() |
144 |
processed = bzr_conflicts.ConflictList.from_stanzas(stanzas_iter) |
|
5898.1.1
by Martin
Refactor conflict stanzas tests to use scenarios |
145 |
self.assertEqual(example_conflicts, processed) |
4597.3.43
by Vincent Ladeuil
Cleanups, ready to record. |
146 |
|
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
147 |
def test_stringification(self): |
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
148 |
for text, o in zip( |
149 |
bzr_conflicts.ConflictList(example_conflicts).to_strings(), |
|
150 |
example_conflicts): |
|
7520.1.4
by Jelmer Vernooij
Fix type. |
151 |
self.assertEqual(text, str(o)) |
5898.1.3
by Martin
Add tests for non-ascii conflict serialisation |
152 |
|
4597.3.43
by Vincent Ladeuil
Cleanups, ready to record. |
153 |
|
4597.3.74
by Vincent Ladeuil
Add a FIXME about rewriting shell-like tests into real whitebox tests. |
154 |
# FIXME: The shell-like tests should be converted to real whitebox tests... or
|
155 |
# moved to a blackbox module -- vila 20100205
|
|
156 |
||
4597.7.11
by Vincent Ladeuil
Fix #531967 by creating helpers for PathConflicts when a deletion |
157 |
# FIXME: test missing for multiple conflicts
|
158 |
||
4597.3.31
by Vincent Ladeuil
Implement --interactive for MissingParent. |
159 |
# FIXME: Tests missing for DuplicateID conflict type
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
160 |
class TestResolveConflicts(script.TestCaseWithTransportAndScript): |
161 |
||
7143.15.2
by Jelmer Vernooij
Run autopep8. |
162 |
preamble = None # The setup script set by daughter classes |
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
163 |
|
164 |
def setUp(self): |
|
165 |
super(TestResolveConflicts, self).setUp() |
|
166 |
self.run_script(self.preamble) |
|
167 |
||
168 |
||
4597.10.11
by Vincent Ladeuil
Turn mirror_scenarios into a simple function. |
169 |
def mirror_scenarios(base_scenarios): |
170 |
"""Return a list of mirrored scenarios. |
|
171 |
||
172 |
Each scenario in base_scenarios is duplicated switching the roles of 'this'
|
|
173 |
and 'other'
|
|
174 |
"""
|
|
175 |
scenarios = [] |
|
4597.10.14
by Vincent Ladeuil
Some more cleanup and typos. |
176 |
for common, (lname, ldict), (rname, rdict) in base_scenarios: |
4597.10.11
by Vincent Ladeuil
Turn mirror_scenarios into a simple function. |
177 |
a = tests.multiply_scenarios([(lname, dict(_this=ldict))], |
178 |
[(rname, dict(_other=rdict))]) |
|
179 |
b = tests.multiply_scenarios([(rname, dict(_this=rdict))], |
|
180 |
[(lname, dict(_other=ldict))]) |
|
181 |
# Inject the common parameters in all scenarios
|
|
182 |
for name, d in a + b: |
|
183 |
d.update(common) |
|
184 |
scenarios.extend(a + b) |
|
185 |
return scenarios |
|
186 |
||
187 |
||
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
188 |
# FIXME: Get rid of parametrized (in the class name) once we delete
|
189 |
# TestResolveConflicts -- vila 20100308
|
|
4597.7.4
by Vincent Ladeuil
Abstract the test class some more to address more conflict |
190 |
class TestParametrizedResolveConflicts(tests.TestCaseWithTransport): |
4597.7.18
by Vincent Ladeuil
Start addressing Andrew's concerns. |
191 |
"""This class provides a base to test single conflict resolution. |
192 |
||
4597.10.7
by Vincent Ladeuil
Simplify scenarios mirroring and give a better docstring for TestParametrizedResolveConflicts. |
193 |
Since all conflict objects are created with specific semantics for their
|
194 |
attributes, each class should implement the necessary functions and
|
|
195 |
attributes described below.
|
|
196 |
||
197 |
Each class should define the scenarios that create the expected (single)
|
|
198 |
conflict.
|
|
199 |
||
200 |
Each scenario describes:
|
|
201 |
* how to create 'base' tree (and revision)
|
|
202 |
* how to create 'left' tree (and revision, parent rev 'base')
|
|
203 |
* how to create 'right' tree (and revision, parent rev 'base')
|
|
204 |
* how to check that changes in 'base'->'left' have been taken
|
|
205 |
* how to check that changes in 'base'->'right' have been taken
|
|
206 |
||
207 |
From each base scenario, we generate two concrete scenarios where:
|
|
208 |
* this=left, other=right
|
|
209 |
* this=right, other=left
|
|
210 |
||
211 |
Then the test case verifies each concrete scenario by:
|
|
212 |
* creating a branch containing the 'base', 'this' and 'other' revisions
|
|
213 |
* creating a working tree for the 'this' revision
|
|
214 |
* performing the merge of 'other' into 'this'
|
|
215 |
* verifying the expected conflict was generated
|
|
216 |
* resolving with --take-this or --take-other, and running the corresponding
|
|
217 |
checks (for either 'base'->'this', or 'base'->'other')
|
|
218 |
||
219 |
:cvar _conflict_type: The expected class of the generated conflict.
|
|
220 |
||
221 |
:cvar _assert_conflict: A method receiving the working tree and the
|
|
222 |
conflict object and checking its attributes.
|
|
223 |
||
4597.10.9
by Vincent Ladeuil
More doc. |
224 |
:cvar _base_actions: The branchbuilder actions to create the 'base'
|
225 |
revision.
|
|
226 |
||
227 |
:cvar _this: The dict related to 'base' -> 'this'. It contains at least:
|
|
228 |
* 'actions': The branchbuilder actions to create the 'this'
|
|
229 |
revision.
|
|
4597.10.10
by Vincent Ladeuil
Fix typo. |
230 |
* 'check': how to check the changes after resolution with --take-this.
|
4597.10.9
by Vincent Ladeuil
More doc. |
231 |
|
232 |
:cvar _other: The dict related to 'base' -> 'other'. It contains at least:
|
|
233 |
* 'actions': The branchbuilder actions to create the 'other'
|
|
234 |
revision.
|
|
4597.10.10
by Vincent Ladeuil
Fix typo. |
235 |
* 'check': how to check the changes after resolution with --take-other.
|
4597.7.18
by Vincent Ladeuil
Start addressing Andrew's concerns. |
236 |
"""
|
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
237 |
|
4597.7.16
by Vincent Ladeuil
Some cleanup. |
238 |
# Set by daughter classes
|
239 |
_conflict_type = None |
|
240 |
_assert_conflict = None |
|
241 |
||
4597.2.26
by Vincent Ladeuil
Fix bug #529968 by renaming the kept file on content conflicts. |
242 |
# Set by load_tests
|
4597.7.6
by Vincent Ladeuil
Cleanup TestParametrizedResolveConflicts some more. |
243 |
_base_actions = None |
4597.10.7
by Vincent Ladeuil
Simplify scenarios mirroring and give a better docstring for TestParametrizedResolveConflicts. |
244 |
_this = None |
245 |
_other = None |
|
4597.7.7
by Vincent Ladeuil
Reproduce bug #531967 on various aspects. |
246 |
|
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
247 |
scenarios = [] |
248 |
"""The scenario list for the conflict type defined by the class. |
|
249 |
||
250 |
Each scenario is of the form:
|
|
251 |
(common, (left_name, left_dict), (right_name, right_dict))
|
|
252 |
||
253 |
* common is a dict
|
|
254 |
||
255 |
* left_name and right_name are the scenario names that will be combined
|
|
256 |
||
257 |
* left_dict and right_dict are the attributes specific to each half of
|
|
258 |
the scenario. They should include at least 'actions' and 'check' and
|
|
259 |
will be available as '_this' and '_other' test instance attributes.
|
|
260 |
||
261 |
Daughters classes are free to add their specific attributes as they see
|
|
262 |
fit in any of the three dicts.
|
|
263 |
||
264 |
This is a class method so that load_tests can find it.
|
|
265 |
||
266 |
'_base_actions' in the common dict, 'actions' and 'check' in the left
|
|
267 |
and right dicts use names that map to methods in the test classes. Some
|
|
268 |
prefixes are added to these names to get the correspong methods (see
|
|
269 |
_get_actions() and _get_check()). The motivation here is to avoid
|
|
270 |
collisions in the class namespace.
|
|
271 |
"""
|
|
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
272 |
|
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
273 |
def setUp(self): |
4597.7.4
by Vincent Ladeuil
Abstract the test class some more to address more conflict |
274 |
super(TestParametrizedResolveConflicts, self).setUp() |
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
275 |
builder = self.make_branch_builder('trunk') |
276 |
builder.start_series() |
|
4597.7.6
by Vincent Ladeuil
Cleanup TestParametrizedResolveConflicts some more. |
277 |
|
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
278 |
# Create an empty trunk
|
6816.2.1
by Jelmer Vernooij
Migrate some build_snapshot code over to having revision_id as keyword argument. |
279 |
builder.build_snapshot(None, [ |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
280 |
('add', (u'', b'root-id', 'directory', ''))], |
281 |
revision_id=b'start') |
|
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
282 |
# Add a minimal base content
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
283 |
base_actions = self._get_actions(self._base_actions)() |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
284 |
builder.build_snapshot([b'start'], base_actions, revision_id=b'base') |
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
285 |
# Modify the base content in branch
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
286 |
actions_other = self._get_actions(self._other['actions'])() |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
287 |
builder.build_snapshot([b'base'], actions_other, revision_id=b'other') |
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
288 |
# Modify the base content in trunk
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
289 |
actions_this = self._get_actions(self._this['actions'])() |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
290 |
builder.build_snapshot([b'base'], actions_this, revision_id=b'this') |
4597.7.7
by Vincent Ladeuil
Reproduce bug #531967 on various aspects. |
291 |
# builder.get_branch() tip is now 'this'
|
4597.7.6
by Vincent Ladeuil
Cleanup TestParametrizedResolveConflicts some more. |
292 |
|
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
293 |
builder.finish_series() |
294 |
self.builder = builder |
|
295 |
||
4597.2.26
by Vincent Ladeuil
Fix bug #529968 by renaming the kept file on content conflicts. |
296 |
def _get_actions(self, name): |
297 |
return getattr(self, 'do_%s' % name) |
|
298 |
||
299 |
def _get_check(self, name): |
|
300 |
return getattr(self, 'check_%s' % name) |
|
301 |
||
4597.2.24
by Vincent Ladeuil
Translate one more test. |
302 |
def _merge_other_into_this(self): |
4597.2.23
by Vincent Ladeuil
Start translating blackbox tests into whitebox ones. |
303 |
b = self.builder.get_branch() |
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
304 |
wt = b.controldir.sprout('branch').open_workingtree() |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
305 |
wt.merge_from_branch(b, b'other') |
4597.2.24
by Vincent Ladeuil
Translate one more test. |
306 |
return wt |
307 |
||
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
308 |
def assertConflict(self, wt): |
309 |
confs = wt.conflicts() |
|
310 |
self.assertLength(1, confs) |
|
311 |
c = confs[0] |
|
312 |
self.assertIsInstance(c, self._conflict_type) |
|
313 |
self._assert_conflict(wt, c) |
|
314 |
||
315 |
def _get_resolve_path_arg(self, wt, action): |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
316 |
raise NotImplementedError(self._get_resolve_path_arg) |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
317 |
|
318 |
def check_resolved(self, wt, action): |
|
319 |
path = self._get_resolve_path_arg(wt, action) |
|
320 |
conflicts.resolve(wt, [path], action=action) |
|
321 |
# Check that we don't have any conflicts nor unknown left
|
|
322 |
self.assertLength(0, wt.conflicts()) |
|
323 |
self.assertLength(0, list(wt.unknowns())) |
|
324 |
||
4597.2.24
by Vincent Ladeuil
Translate one more test. |
325 |
def test_resolve_taking_this(self): |
326 |
wt = self._merge_other_into_this() |
|
4597.7.7
by Vincent Ladeuil
Reproduce bug #531967 on various aspects. |
327 |
self.assertConflict(wt) |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
328 |
self.check_resolved(wt, 'take_this') |
4597.10.7
by Vincent Ladeuil
Simplify scenarios mirroring and give a better docstring for TestParametrizedResolveConflicts. |
329 |
check_this = self._get_check(self._this['check']) |
4597.2.26
by Vincent Ladeuil
Fix bug #529968 by renaming the kept file on content conflicts. |
330 |
check_this() |
4597.2.24
by Vincent Ladeuil
Translate one more test. |
331 |
|
332 |
def test_resolve_taking_other(self): |
|
333 |
wt = self._merge_other_into_this() |
|
4597.7.7
by Vincent Ladeuil
Reproduce bug #531967 on various aspects. |
334 |
self.assertConflict(wt) |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
335 |
self.check_resolved(wt, 'take_other') |
4597.10.7
by Vincent Ladeuil
Simplify scenarios mirroring and give a better docstring for TestParametrizedResolveConflicts. |
336 |
check_other = self._get_check(self._other['check']) |
4597.2.26
by Vincent Ladeuil
Fix bug #529968 by renaming the kept file on content conflicts. |
337 |
check_other() |
4597.3.28
by Vincent Ladeuil
Implement --interactive for ContentsConflict. |
338 |
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
339 |
|
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
340 |
class TestResolveTextConflicts(TestParametrizedResolveConflicts): |
341 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
342 |
_conflict_type = bzr_conflicts.TextConflict |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
343 |
|
344 |
# Set by the scenarios
|
|
345 |
# path and file-id for the file involved in the conflict
|
|
346 |
_path = None |
|
347 |
_file_id = None |
|
348 |
||
349 |
scenarios = mirror_scenarios( |
|
350 |
[
|
|
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
351 |
# File modified on both sides
|
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
352 |
(dict(_base_actions='create_file', |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
353 |
_path='file', _file_id=b'file-id'), |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
354 |
('filed_modified_A', |
355 |
dict(actions='modify_file_A', check='file_has_content_A')), |
|
356 |
('file_modified_B', |
|
357 |
dict(actions='modify_file_B', check='file_has_content_B')),), |
|
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
358 |
# File modified on both sides in dir
|
359 |
(dict(_base_actions='create_file_in_dir', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
360 |
_path='dir/file', _file_id=b'file-id'), |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
361 |
('filed_modified_A_in_dir', |
6883.22.4
by Jelmer Vernooij
Fix some conflict tests. |
362 |
dict(actions='modify_file_A_in_dir', |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
363 |
check='file_in_dir_has_content_A')), |
364 |
('file_modified_B', |
|
6883.22.4
by Jelmer Vernooij
Fix some conflict tests. |
365 |
dict(actions='modify_file_B_in_dir', |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
366 |
check='file_in_dir_has_content_B')),), |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
367 |
])
|
368 |
||
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
369 |
def do_create_file(self, path='file'): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
370 |
return [('add', (path, b'file-id', 'file', b'trunk content\n'))] |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
371 |
|
372 |
def do_modify_file_A(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
373 |
return [('modify', ('file', b'trunk content\nfeature A\n'))] |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
374 |
|
375 |
def do_modify_file_B(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
376 |
return [('modify', ('file', b'trunk content\nfeature B\n'))] |
6883.22.4
by Jelmer Vernooij
Fix some conflict tests. |
377 |
|
378 |
def do_modify_file_A_in_dir(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
379 |
return [('modify', ('dir/file', b'trunk content\nfeature A\n'))] |
6883.22.4
by Jelmer Vernooij
Fix some conflict tests. |
380 |
|
381 |
def do_modify_file_B_in_dir(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
382 |
return [('modify', ('dir/file', b'trunk content\nfeature B\n'))] |
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
383 |
|
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
384 |
def check_file_has_content_A(self, path='file'): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
385 |
self.assertFileEqual(b'trunk content\nfeature A\n', |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
386 |
osutils.pathjoin('branch', path)) |
387 |
||
388 |
def check_file_has_content_B(self, path='file'): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
389 |
self.assertFileEqual(b'trunk content\nfeature B\n', |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
390 |
osutils.pathjoin('branch', path)) |
391 |
||
392 |
def do_create_file_in_dir(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
393 |
return [('add', ('dir', b'dir-id', 'directory', '')), |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
394 |
] + self.do_create_file('dir/file') |
5609.17.1
by Vincent Ladeuil
Reproduce bug #715068. |
395 |
|
396 |
def check_file_in_dir_has_content_A(self): |
|
397 |
self.check_file_has_content_A('dir/file') |
|
398 |
||
399 |
def check_file_in_dir_has_content_B(self): |
|
400 |
self.check_file_has_content_B('dir/file') |
|
4597.14.2
by Vincent Ladeuil
Implements --take-this and --take-other when resolving text conflicts |
401 |
|
402 |
def _get_resolve_path_arg(self, wt, action): |
|
403 |
return self._path |
|
404 |
||
405 |
def assertTextConflict(self, wt, c): |
|
406 |
self.assertEqual(self._file_id, c.file_id) |
|
407 |
self.assertEqual(self._path, c.path) |
|
408 |
_assert_conflict = assertTextConflict |
|
409 |
||
410 |
||
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
411 |
class TestResolveContentsConflict(TestParametrizedResolveConflicts): |
412 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
413 |
_conflict_type = bzr_conflicts.ContentsConflict |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
414 |
|
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
415 |
# Set by the scenarios
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
416 |
# path and file-id for the file involved in the conflict
|
417 |
_path = None |
|
418 |
_file_id = None |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
419 |
|
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
420 |
scenarios = mirror_scenarios( |
421 |
[
|
|
4597.10.12
by Vincent Ladeuil
Some more doc. |
422 |
# File modified/deleted
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
423 |
(dict(_base_actions='create_file', |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
424 |
_path='file', _file_id=b'file-id'), |
4597.10.12
by Vincent Ladeuil
Some more doc. |
425 |
('file_modified', |
426 |
dict(actions='modify_file', check='file_has_more_content')), |
|
427 |
('file_deleted', |
|
428 |
dict(actions='delete_file', check='file_doesnt_exist')),), |
|
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
429 |
# File renamed-modified/deleted
|
430 |
(dict(_base_actions='create_file', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
431 |
_path='new-file', _file_id=b'file-id'), |
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
432 |
('file_renamed_and_modified', |
433 |
dict(actions='modify_and_rename_file', |
|
434 |
check='file_renamed_and_more_content')), |
|
435 |
('file_deleted', |
|
436 |
dict(actions='delete_file', check='file_doesnt_exist')),), |
|
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
437 |
# File modified/deleted in dir
|
438 |
(dict(_base_actions='create_file_in_dir', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
439 |
_path='dir/file', _file_id=b'file-id'), |
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
440 |
('file_modified_in_dir', |
441 |
dict(actions='modify_file_in_dir', |
|
442 |
check='file_in_dir_has_more_content')), |
|
443 |
('file_deleted_in_dir', |
|
6883.22.6
by Jelmer Vernooij
Fix some more tests. |
444 |
dict(actions='delete_file_in_dir', |
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
445 |
check='file_in_dir_doesnt_exist')),), |
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
446 |
])
|
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
447 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
448 |
def do_create_file(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
449 |
return [('add', ('file', b'file-id', 'file', b'trunk content\n'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
450 |
|
451 |
def do_modify_file(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
452 |
return [('modify', ('file', b'trunk content\nmore content\n'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
453 |
|
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
454 |
def do_modify_and_rename_file(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
455 |
return [('modify', ('new-file', b'trunk content\nmore content\n')), |
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
456 |
('rename', ('file', 'new-file'))] |
457 |
||
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
458 |
def check_file_has_more_content(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
459 |
self.assertFileEqual(b'trunk content\nmore content\n', 'branch/file') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
460 |
|
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
461 |
def check_file_renamed_and_more_content(self): |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
462 |
self.assertFileEqual( |
463 |
b'trunk content\nmore content\n', 'branch/new-file') |
|
5988.2.1
by Vincent Ladeuil
Do not generate path conflicts if a corresponding content conflict exists |
464 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
465 |
def do_delete_file(self): |
6883.22.5
by Jelmer Vernooij
Fix more tests. |
466 |
return [('unversion', 'file')] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
467 |
|
6883.22.6
by Jelmer Vernooij
Fix some more tests. |
468 |
def do_delete_file_in_dir(self): |
469 |
return [('unversion', 'dir/file')] |
|
470 |
||
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
471 |
def check_file_doesnt_exist(self): |
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
472 |
self.assertPathDoesNotExist('branch/file') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
473 |
|
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
474 |
def do_create_file_in_dir(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
475 |
return [('add', ('dir', b'dir-id', 'directory', '')), |
476 |
('add', ('dir/file', b'file-id', 'file', b'trunk content\n'))] |
|
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
477 |
|
478 |
def do_modify_file_in_dir(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
479 |
return [('modify', ('dir/file', b'trunk content\nmore content\n'))] |
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
480 |
|
481 |
def check_file_in_dir_has_more_content(self): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
482 |
self.assertFileEqual( |
483 |
b'trunk content\nmore content\n', 'branch/dir/file') |
|
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
484 |
|
485 |
def check_file_in_dir_doesnt_exist(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
486 |
self.assertPathDoesNotExist('branch/dir/file') |
5050.63.3
by Vincent Ladeuil
Correctly resolve content conflicts for files in subdirs |
487 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
488 |
def _get_resolve_path_arg(self, wt, action): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
489 |
return self._path |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
490 |
|
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
491 |
def assertContentsConflict(self, wt, c): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
492 |
self.assertEqual(self._file_id, c.file_id) |
493 |
self.assertEqual(self._path, c.path) |
|
4597.7.16
by Vincent Ladeuil
Some cleanup. |
494 |
_assert_conflict = assertContentsConflict |
495 |
||
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
496 |
|
497 |
class TestResolvePathConflict(TestParametrizedResolveConflicts): |
|
498 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
499 |
_conflict_type = bzr_conflicts.PathConflict |
4597.7.16
by Vincent Ladeuil
Some cleanup. |
500 |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
501 |
def do_nothing(self): |
502 |
return [] |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
503 |
|
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
504 |
# Each side dict additionally defines:
|
505 |
# - path path involved (can be '<deleted>')
|
|
506 |
# - file-id involved
|
|
507 |
scenarios = mirror_scenarios( |
|
508 |
[
|
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
509 |
# File renamed/deleted
|
510 |
(dict(_base_actions='create_file'), |
|
511 |
('file_renamed', |
|
512 |
dict(actions='rename_file', check='file_renamed', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
513 |
path='new-file', file_id=b'file-id')), |
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
514 |
('file_deleted', |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
515 |
dict(actions='delete_file', check='file_doesnt_exist', |
516 |
# PathConflicts deletion handling requires a special
|
|
517 |
# hard-coded value
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
518 |
path='<deleted>', file_id=b'file-id')),), |
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
519 |
# File renamed/deleted in dir
|
520 |
(dict(_base_actions='create_file_in_dir'), |
|
521 |
('file_renamed_in_dir', |
|
522 |
dict(actions='rename_file_in_dir', check='file_in_dir_renamed', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
523 |
path='dir/new-file', file_id=b'file-id')), |
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
524 |
('file_deleted', |
6883.22.5
by Jelmer Vernooij
Fix more tests. |
525 |
dict(actions='delete_file_in_dir', check='file_in_dir_doesnt_exist', |
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
526 |
# PathConflicts deletion handling requires a special
|
527 |
# hard-coded value
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
528 |
path='<deleted>', file_id=b'file-id')),), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
529 |
# File renamed/renamed differently
|
530 |
(dict(_base_actions='create_file'), |
|
531 |
('file_renamed', |
|
532 |
dict(actions='rename_file', check='file_renamed', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
533 |
path='new-file', file_id=b'file-id')), |
4597.8.4
by Vincent Ladeuil
Delete PathConflict bloackbox tests. |
534 |
('file_renamed2', |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
535 |
dict(actions='rename_file2', check='file_renamed2', |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
536 |
path='new-file2', file_id=b'file-id')),), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
537 |
# Dir renamed/deleted
|
538 |
(dict(_base_actions='create_dir'), |
|
539 |
('dir_renamed', |
|
540 |
dict(actions='rename_dir', check='dir_renamed', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
541 |
path='new-dir', file_id=b'dir-id')), |
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
542 |
('dir_deleted', |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
543 |
dict(actions='delete_dir', check='dir_doesnt_exist', |
544 |
# PathConflicts deletion handling requires a special
|
|
545 |
# hard-coded value
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
546 |
path='<deleted>', file_id=b'dir-id')),), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
547 |
# Dir renamed/renamed differently
|
548 |
(dict(_base_actions='create_dir'), |
|
549 |
('dir_renamed', |
|
550 |
dict(actions='rename_dir', check='dir_renamed', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
551 |
path='new-dir', file_id=b'dir-id')), |
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
552 |
('dir_renamed2', |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
553 |
dict(actions='rename_dir2', check='dir_renamed2', |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
554 |
path='new-dir2', file_id=b'dir-id')),), |
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
555 |
])
|
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
556 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
557 |
def do_create_file(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
558 |
return [('add', ('file', b'file-id', 'file', b'trunk content\n'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
559 |
|
560 |
def do_create_dir(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
561 |
return [('add', ('dir', b'dir-id', 'directory', ''))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
562 |
|
563 |
def do_rename_file(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
564 |
return [('rename', ('file', 'new-file'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
565 |
|
566 |
def check_file_renamed(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
567 |
self.assertPathDoesNotExist('branch/file') |
568 |
self.assertPathExists('branch/new-file') |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
569 |
|
570 |
def do_rename_file2(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
571 |
return [('rename', ('file', 'new-file2'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
572 |
|
573 |
def check_file_renamed2(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
574 |
self.assertPathDoesNotExist('branch/file') |
575 |
self.assertPathExists('branch/new-file2') |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
576 |
|
577 |
def do_rename_dir(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
578 |
return [('rename', ('dir', 'new-dir'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
579 |
|
580 |
def check_dir_renamed(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
581 |
self.assertPathDoesNotExist('branch/dir') |
582 |
self.assertPathExists('branch/new-dir') |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
583 |
|
584 |
def do_rename_dir2(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
585 |
return [('rename', ('dir', 'new-dir2'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
586 |
|
587 |
def check_dir_renamed2(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
588 |
self.assertPathDoesNotExist('branch/dir') |
589 |
self.assertPathExists('branch/new-dir2') |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
590 |
|
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
591 |
def do_delete_file(self): |
6883.22.5
by Jelmer Vernooij
Fix more tests. |
592 |
return [('unversion', 'file')] |
593 |
||
594 |
def do_delete_file_in_dir(self): |
|
595 |
return [('unversion', 'dir/file')] |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
596 |
|
597 |
def check_file_doesnt_exist(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
598 |
self.assertPathDoesNotExist('branch/file') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
599 |
|
600 |
def do_delete_dir(self): |
|
6883.22.5
by Jelmer Vernooij
Fix more tests. |
601 |
return [('unversion', 'dir')] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
602 |
|
603 |
def check_dir_doesnt_exist(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
604 |
self.assertPathDoesNotExist('branch/dir') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
605 |
|
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
606 |
def do_create_file_in_dir(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
607 |
return [('add', ('dir', b'dir-id', 'directory', '')), |
608 |
('add', ('dir/file', b'file-id', 'file', b'trunk content\n'))] |
|
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
609 |
|
610 |
def do_rename_file_in_dir(self): |
|
611 |
return [('rename', ('dir/file', 'dir/new-file'))] |
|
612 |
||
613 |
def check_file_in_dir_renamed(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
614 |
self.assertPathDoesNotExist('branch/dir/file') |
615 |
self.assertPathExists('branch/dir/new-file') |
|
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
616 |
|
617 |
def check_file_in_dir_doesnt_exist(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
618 |
self.assertPathDoesNotExist('branch/dir/file') |
5050.63.6
by Vincent Ladeuil
Same fix for path conflicts. |
619 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
620 |
def _get_resolve_path_arg(self, wt, action): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
621 |
tpath = self._this['path'] |
622 |
opath = self._other['path'] |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
623 |
if tpath == '<deleted>': |
624 |
path = opath |
|
625 |
else: |
|
626 |
path = tpath |
|
627 |
return path |
|
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
628 |
|
629 |
def assertPathConflict(self, wt, c): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
630 |
tpath = self._this['path'] |
631 |
tfile_id = self._this['file_id'] |
|
632 |
opath = self._other['path'] |
|
633 |
ofile_id = self._other['file_id'] |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
634 |
self.assertEqual(tfile_id, ofile_id) # Sanity check |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
635 |
self.assertEqual(tfile_id, c.file_id) |
636 |
self.assertEqual(tpath, c.path) |
|
637 |
self.assertEqual(opath, c.conflict_path) |
|
4597.7.16
by Vincent Ladeuil
Some cleanup. |
638 |
_assert_conflict = assertPathConflict |
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
639 |
|
640 |
||
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
641 |
class TestResolvePathConflictBefore531967(TestResolvePathConflict): |
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
642 |
"""Same as TestResolvePathConflict but a specific conflict object. |
643 |
"""
|
|
644 |
||
4597.7.16
by Vincent Ladeuil
Some cleanup. |
645 |
def assertPathConflict(self, c): |
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
646 |
# We create a conflict object as it was created before the fix and
|
647 |
# inject it into the working tree, the test will exercise the
|
|
648 |
# compatibility code.
|
|
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
649 |
old_c = bzr_conflicts.PathConflict('<deleted>', self._item_path, |
4597.7.17
by Vincent Ladeuil
Add a scenario and activate the compatibility tests. |
650 |
file_id=None) |
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
651 |
wt.set_conflicts([old_c]) |
4597.7.10
by Vincent Ladeuil
Define scenarios by test classes. |
652 |
|
653 |
||
4597.8.5
by Vincent Ladeuil
Replace DuplicateEntry blackbox tests by whitebox ones. |
654 |
class TestResolveDuplicateEntry(TestParametrizedResolveConflicts): |
655 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
656 |
_conflict_type = bzr_conflicts.DuplicateEntry |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
657 |
|
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
658 |
scenarios = mirror_scenarios( |
659 |
[
|
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
660 |
# File created with different file-ids
|
661 |
(dict(_base_actions='nothing'), |
|
662 |
('filea_created', |
|
663 |
dict(actions='create_file_a', check='file_content_a', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
664 |
path='file', file_id=b'file-a-id')), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
665 |
('fileb_created', |
666 |
dict(actions='create_file_b', check='file_content_b', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
667 |
path='file', file_id=b'file-b-id')),), |
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
668 |
# File created with different file-ids but deleted on one side
|
669 |
(dict(_base_actions='create_file_a'), |
|
670 |
('filea_replaced', |
|
671 |
dict(actions='replace_file_a_by_b', check='file_content_b', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
672 |
path='file', file_id=b'file-b-id')), |
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
673 |
('filea_modified', |
674 |
dict(actions='modify_file_a', check='file_new_content', |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
675 |
path='file', file_id=b'file-a-id')),), |
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
676 |
])
|
4597.8.5
by Vincent Ladeuil
Replace DuplicateEntry blackbox tests by whitebox ones. |
677 |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
678 |
def do_nothing(self): |
679 |
return [] |
|
680 |
||
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
681 |
def do_create_file_a(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
682 |
return [('add', ('file', b'file-a-id', 'file', b'file a content\n'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
683 |
|
684 |
def check_file_content_a(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
685 |
self.assertFileEqual(b'file a content\n', 'branch/file') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
686 |
|
687 |
def do_create_file_b(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
688 |
return [('add', ('file', b'file-b-id', 'file', b'file b content\n'))] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
689 |
|
690 |
def check_file_content_b(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
691 |
self.assertFileEqual(b'file b content\n', 'branch/file') |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
692 |
|
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
693 |
def do_replace_file_a_by_b(self): |
6883.22.6
by Jelmer Vernooij
Fix some more tests. |
694 |
return [('unversion', 'file'), |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
695 |
('add', ('file', b'file-b-id', 'file', b'file b content\n'))] |
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
696 |
|
697 |
def do_modify_file_a(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
698 |
return [('modify', ('file', b'new content\n'))] |
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
699 |
|
700 |
def check_file_new_content(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
701 |
self.assertFileEqual(b'new content\n', 'branch/file') |
6015.47.3
by Vincent Ladeuil
Failing tests reproducing bug #880701. |
702 |
|
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
703 |
def _get_resolve_path_arg(self, wt, action): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
704 |
return self._this['path'] |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
705 |
|
4597.8.5
by Vincent Ladeuil
Replace DuplicateEntry blackbox tests by whitebox ones. |
706 |
def assertDuplicateEntry(self, wt, c): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
707 |
tpath = self._this['path'] |
708 |
tfile_id = self._this['file_id'] |
|
709 |
opath = self._other['path'] |
|
710 |
ofile_id = self._other['file_id'] |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
711 |
self.assertEqual(tpath, opath) # Sanity check |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
712 |
self.assertEqual(tfile_id, c.file_id) |
713 |
self.assertEqual(tpath + '.moved', c.path) |
|
714 |
self.assertEqual(tpath, c.conflict_path) |
|
4597.8.5
by Vincent Ladeuil
Replace DuplicateEntry blackbox tests by whitebox ones. |
715 |
_assert_conflict = assertDuplicateEntry |
4597.3.19
by Vincent Ladeuil
Some failing tests. |
716 |
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
717 |
|
718 |
class TestResolveUnversionedParent(TestResolveConflicts): |
|
719 |
||
4597.3.29
by Vincent Ladeuil
Fix bogus tests. |
720 |
# FIXME: Add the reverse tests: dir deleted in trunk, file added in branch
|
721 |
||
4597.3.30
by Vincent Ladeuil
Light changes learned while starting to understand multiple conflicts on |
722 |
# FIXME: While this *creates* UnversionedParent conflicts, this really only
|
723 |
# tests MissingParent resolution :-/
|
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
724 |
preamble = """ |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
725 |
$ brz init trunk
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
726 |
...
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
727 |
$ cd trunk
|
4597.3.29
by Vincent Ladeuil
Fix bogus tests. |
728 |
$ mkdir dir
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
729 |
$ brz add -q dir
|
730 |
$ brz commit -m 'Create trunk' -q
|
|
4597.3.29
by Vincent Ladeuil
Fix bogus tests. |
731 |
$ echo 'trunk content' >dir/file
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
732 |
$ brz add -q dir/file
|
733 |
$ brz commit -q -m 'Add dir/file in trunk'
|
|
734 |
$ brz branch -q . -r 1 ../branch
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
735 |
$ cd ../branch
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
736 |
$ brz rm dir -q
|
737 |
$ brz commit -q -m 'Remove dir in branch'
|
|
738 |
$ brz merge ../trunk
|
|
4597.3.29
by Vincent Ladeuil
Fix bogus tests. |
739 |
2>+N dir/
|
740 |
2>+N dir/file
|
|
741 |
2>Conflict adding files to dir. Created directory.
|
|
742 |
2>Conflict because dir is not versioned, but has versioned children. Versioned directory.
|
|
743 |
2>2 conflicts encountered.
|
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
744 |
"""
|
745 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
746 |
def test_take_this(self): |
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
747 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
748 |
$ brz rm -q dir --no-backup
|
749 |
$ brz resolve dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
750 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
751 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
752 |
""") |
753 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
754 |
def test_take_other(self): |
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
755 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
756 |
$ brz resolve dir
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
757 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
758 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
759 |
""") |
760 |
||
761 |
||
762 |
class TestResolveMissingParent(TestResolveConflicts): |
|
763 |
||
764 |
preamble = """ |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
765 |
$ brz init trunk
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
766 |
...
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
767 |
$ cd trunk
|
768 |
$ mkdir dir
|
|
769 |
$ echo 'trunk content' >dir/file
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
770 |
$ brz add -q
|
771 |
$ brz commit -m 'Create trunk' -q
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
772 |
$ echo 'trunk content' >dir/file2
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
773 |
$ brz add -q dir/file2
|
774 |
$ brz commit -q -m 'Add dir/file2 in branch'
|
|
775 |
$ brz branch -q . -r 1 ../branch
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
776 |
$ cd ../branch
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
777 |
$ brz rm -q dir/file --no-backup
|
778 |
$ brz rm -q dir
|
|
779 |
$ brz commit -q -m 'Remove dir/file'
|
|
780 |
$ brz merge ../trunk
|
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
781 |
2>+N dir/
|
782 |
2>+N dir/file2
|
|
783 |
2>Conflict adding files to dir. Created directory.
|
|
784 |
2>Conflict because dir is not versioned, but has versioned children. Versioned directory.
|
|
785 |
2>2 conflicts encountered.
|
|
786 |
"""
|
|
787 |
||
788 |
def test_keep_them_all(self): |
|
789 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
790 |
$ brz resolve dir
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
791 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
792 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
793 |
""") |
794 |
||
795 |
def test_adopt_child(self): |
|
796 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
797 |
$ brz mv -q dir/file2 file2
|
798 |
$ brz rm -q dir --no-backup
|
|
799 |
$ brz resolve dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
800 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
801 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
802 |
""") |
803 |
||
804 |
def test_kill_them_all(self): |
|
805 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
806 |
$ brz rm -q dir --no-backup
|
807 |
$ brz resolve dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
808 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
809 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
810 |
""") |
811 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
812 |
def test_resolve_taking_this(self): |
4597.3.31
by Vincent Ladeuil
Implement --interactive for MissingParent. |
813 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
814 |
$ brz resolve --take-this dir
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
815 |
2>...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
816 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.31
by Vincent Ladeuil
Implement --interactive for MissingParent. |
817 |
""") |
818 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
819 |
def test_resolve_taking_other(self): |
4597.3.31
by Vincent Ladeuil
Implement --interactive for MissingParent. |
820 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
821 |
$ brz resolve --take-other dir
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
822 |
2>...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
823 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.31
by Vincent Ladeuil
Implement --interactive for MissingParent. |
824 |
""") |
825 |
||
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
826 |
|
827 |
class TestResolveDeletingParent(TestResolveConflicts): |
|
828 |
||
829 |
preamble = """ |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
830 |
$ brz init trunk
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
831 |
...
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
832 |
$ cd trunk
|
833 |
$ mkdir dir
|
|
834 |
$ echo 'trunk content' >dir/file
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
835 |
$ brz add -q
|
836 |
$ brz commit -m 'Create trunk' -q
|
|
837 |
$ brz rm -q dir/file --no-backup
|
|
838 |
$ brz rm -q dir --no-backup
|
|
839 |
$ brz commit -q -m 'Remove dir/file'
|
|
840 |
$ brz branch -q . -r 1 ../branch
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
841 |
$ cd ../branch
|
842 |
$ echo 'branch content' >dir/file2
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
843 |
$ brz add -q dir/file2
|
844 |
$ brz commit -q -m 'Add dir/file2 in branch'
|
|
845 |
$ brz merge ../trunk
|
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
846 |
2>-D dir/file
|
847 |
2>Conflict: can't delete dir because it is not empty. Not deleting.
|
|
848 |
2>Conflict because dir is not versioned, but has versioned children. Versioned directory.
|
|
849 |
2>2 conflicts encountered.
|
|
850 |
"""
|
|
851 |
||
852 |
def test_keep_them_all(self): |
|
853 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
854 |
$ brz resolve dir
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
855 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
856 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
857 |
""") |
858 |
||
859 |
def test_adopt_child(self): |
|
860 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
861 |
$ brz mv -q dir/file2 file2
|
862 |
$ brz rm -q dir --no-backup
|
|
863 |
$ brz resolve dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
864 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
865 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
866 |
""") |
867 |
||
868 |
def test_kill_them_all(self): |
|
869 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
870 |
$ brz rm -q dir --no-backup
|
871 |
$ brz resolve dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
872 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
873 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
874 |
""") |
875 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
876 |
def test_resolve_taking_this(self): |
4597.3.32
by Vincent Ladeuil
Implement --interactive for DeletingParent noting the inconsistency. |
877 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
878 |
$ brz resolve --take-this dir
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
879 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
880 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.32
by Vincent Ladeuil
Implement --interactive for DeletingParent noting the inconsistency. |
881 |
""") |
882 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
883 |
def test_resolve_taking_other(self): |
4597.3.32
by Vincent Ladeuil
Implement --interactive for DeletingParent noting the inconsistency. |
884 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
885 |
$ brz resolve --take-other dir
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
886 |
2>deleted dir/file2
|
887 |
2>deleted dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
888 |
2>2 conflicts resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
889 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.32
by Vincent Ladeuil
Implement --interactive for DeletingParent noting the inconsistency. |
890 |
""") |
891 |
||
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
892 |
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
893 |
class TestResolveParentLoop(TestParametrizedResolveConflicts): |
894 |
||
7490.129.3
by Jelmer Vernooij
Split out bzr-specific Conflicts code. |
895 |
_conflict_type = bzr_conflicts.ParentLoop |
4597.10.1
by Vincent Ladeuil
Refactor to better handle various conflict types. |
896 |
|
897 |
_this_args = None |
|
898 |
_other_args = None |
|
899 |
||
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
900 |
# Each side dict additionally defines:
|
901 |
# - dir_id: the directory being moved
|
|
902 |
# - target_id: The target directory
|
|
903 |
# - xfail: whether the test is expected to fail if the action is
|
|
904 |
# involved as 'other'
|
|
905 |
scenarios = mirror_scenarios( |
|
906 |
[
|
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
907 |
# Dirs moved into each other
|
908 |
(dict(_base_actions='create_dir1_dir2'), |
|
909 |
('dir1_into_dir2', |
|
910 |
dict(actions='move_dir1_into_dir2', check='dir1_moved', |
|
7058.4.6
by Jelmer Vernooij
Fix some conflict tests. |
911 |
dir_id=b'dir1-id', target_id=b'dir2-id', xfail=False)), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
912 |
('dir2_into_dir1', |
913 |
dict(actions='move_dir2_into_dir1', check='dir2_moved', |
|
7058.4.6
by Jelmer Vernooij
Fix some conflict tests. |
914 |
dir_id=b'dir2-id', target_id=b'dir1-id', xfail=False))), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
915 |
# Subdirs moved into each other
|
916 |
(dict(_base_actions='create_dir1_4'), |
|
917 |
('dir1_into_dir4', |
|
918 |
dict(actions='move_dir1_into_dir4', check='dir1_2_moved', |
|
7058.4.6
by Jelmer Vernooij
Fix some conflict tests. |
919 |
dir_id=b'dir1-id', target_id=b'dir4-id', xfail=True)), |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
920 |
('dir3_into_dir2', |
921 |
dict(actions='move_dir3_into_dir2', check='dir3_4_moved', |
|
7058.4.6
by Jelmer Vernooij
Fix some conflict tests. |
922 |
dir_id=b'dir3-id', target_id=b'dir2-id', xfail=True))), |
4597.13.3
by Vincent Ladeuil
Switch to load_tests_apply_scenarios. |
923 |
])
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
924 |
|
925 |
def do_create_dir1_dir2(self): |
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
926 |
return [('add', ('dir1', b'dir1-id', 'directory', '')), |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
927 |
('add', ('dir2', b'dir2-id', 'directory', '')), ] |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
928 |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
929 |
def do_move_dir1_into_dir2(self): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
930 |
return [('rename', ('dir1', 'dir2/dir1'))] |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
931 |
|
932 |
def check_dir1_moved(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
933 |
self.assertPathDoesNotExist('branch/dir1') |
934 |
self.assertPathExists('branch/dir2/dir1') |
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
935 |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
936 |
def do_move_dir2_into_dir1(self): |
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
937 |
return [('rename', ('dir2', 'dir1/dir2'))] |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
938 |
|
939 |
def check_dir2_moved(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
940 |
self.assertPathDoesNotExist('branch/dir2') |
941 |
self.assertPathExists('branch/dir1/dir2') |
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
942 |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
943 |
def do_create_dir1_4(self): |
6973.11.7
by Jelmer Vernooij
Fix more tests. |
944 |
return [('add', ('dir1', b'dir1-id', 'directory', '')), |
945 |
('add', ('dir1/dir2', b'dir2-id', 'directory', '')), |
|
946 |
('add', ('dir3', b'dir3-id', 'directory', '')), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
947 |
('add', ('dir3/dir4', b'dir4-id', 'directory', '')), ] |
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
948 |
|
949 |
def do_move_dir1_into_dir4(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
950 |
return [('rename', ('dir1', 'dir3/dir4/dir1'))] |
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
951 |
|
952 |
def check_dir1_2_moved(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
953 |
self.assertPathDoesNotExist('branch/dir1') |
954 |
self.assertPathExists('branch/dir3/dir4/dir1') |
|
955 |
self.assertPathExists('branch/dir3/dir4/dir1/dir2') |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
956 |
|
957 |
def do_move_dir3_into_dir2(self): |
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
958 |
return [('rename', ('dir3', 'dir1/dir2/dir3'))] |
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
959 |
|
960 |
def check_dir3_4_moved(self): |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
961 |
self.assertPathDoesNotExist('branch/dir3') |
962 |
self.assertPathExists('branch/dir1/dir2/dir3') |
|
963 |
self.assertPathExists('branch/dir1/dir2/dir3/dir4') |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
964 |
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
965 |
def _get_resolve_path_arg(self, wt, action): |
4597.10.9
by Vincent Ladeuil
More doc. |
966 |
# ParentLoop says: moving <conflict_path> into <path>. Cancelled move.
|
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
967 |
# But since <path> doesn't exist in the working tree, we need to use
|
4597.10.9
by Vincent Ladeuil
More doc. |
968 |
# <conflict_path> instead, and that, in turn, is given by dir_id. Pfew.
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
969 |
return wt.id2path(self._other['dir_id']) |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
970 |
|
971 |
def assertParentLoop(self, wt, c): |
|
7045.5.4
by Jelmer Vernooij
Fix a few more tests. |
972 |
self.assertEqual(self._other['dir_id'], c.file_id) |
973 |
self.assertEqual(self._other['target_id'], c.conflict_file_id) |
|
4597.8.8
by Vincent Ladeuil
Exhibit bug #537956. |
974 |
# The conflict paths are irrelevant (they are deterministic but not
|
975 |
# worth checking since they don't provide the needed information
|
|
976 |
# anyway)
|
|
4597.10.8
by Vincent Ladeuil
Separate actions and conflict attributes. |
977 |
if self._other['xfail']: |
978 |
# It's a bit hackish to raise from here relying on being called for
|
|
979 |
# both tests but this avoid overriding test_resolve_taking_other
|
|
6050.1.2
by Martin
Make tests raising KnownFailure use the knownFailure method instead |
980 |
self.knownFailure( |
4597.10.4
by Vincent Ladeuil
Handle TestResolveParentLoop expected failures more precisely. |
981 |
"ParentLoop doesn't carry enough info to resolve --take-other") |
4597.8.7
by Vincent Ladeuil
Add whitebox tests for ParentLoop. |
982 |
_assert_conflict = assertParentLoop |
983 |
||
984 |
||
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
985 |
class TestResolveNonDirectoryParent(TestResolveConflicts): |
986 |
||
987 |
preamble = """ |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
988 |
$ brz init trunk
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
989 |
...
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
990 |
$ cd trunk
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
991 |
$ brz mkdir foo
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
992 |
...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
993 |
$ brz commit -m 'Create trunk' -q
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
994 |
$ echo "Boing" >foo/bar
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
995 |
$ brz add -q foo/bar
|
996 |
$ brz commit -q -m 'Add foo/bar'
|
|
997 |
$ brz branch -q . -r 1 ../branch
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
998 |
$ cd ../branch
|
999 |
$ rm -r foo
|
|
1000 |
$ echo "Boo!" >foo
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1001 |
$ brz commit -q -m 'foo is now a file'
|
1002 |
$ brz merge ../trunk
|
|
7058.3.2
by Jelmer Vernooij
More consistent output. |
1003 |
2>RK foo => foo.new/
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1004 |
2>+N foo.new/bar
|
1005 |
# FIXME: The message is misleading, foo.new *is* a directory when the message
|
|
1006 |
# is displayed -- vila 090916
|
|
1007 |
2>Conflict: foo.new is not a directory, but has files in it. Created directory.
|
|
1008 |
2>1 conflicts encountered.
|
|
1009 |
"""
|
|
1010 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1011 |
def test_take_this(self): |
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1012 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1013 |
$ brz rm -q foo.new --no-backup
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1014 |
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
|
1015 |
# aside ? -- vila 090916
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1016 |
$ brz add -q foo
|
1017 |
$ brz resolve foo.new
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
1018 |
2>1 conflict resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1019 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1020 |
""") |
1021 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1022 |
def test_take_other(self): |
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1023 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1024 |
$ brz rm -q foo --no-backup
|
1025 |
$ brz mv -q foo.new foo
|
|
1026 |
$ brz resolve foo
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
1027 |
2>1 conflict resolved, 0 remaining
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1028 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1029 |
""") |
1030 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1031 |
def test_resolve_taking_this(self): |
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1032 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1033 |
$ brz resolve --take-this foo.new
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
1034 |
2>...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1035 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1036 |
""") |
1037 |
||
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1038 |
def test_resolve_taking_other(self): |
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1039 |
self.run_script(""" |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1040 |
$ brz resolve --take-other foo.new
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
1041 |
2>...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1042 |
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
|
4597.3.35
by Vincent Ladeuil
Implement --interactive for NonDirectoryParent, sort of. |
1043 |
""") |
1044 |
||
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1045 |
|
1046 |
class TestMalformedTransform(script.TestCaseWithTransportAndScript): |
|
1047 |
||
1048 |
def test_bug_430129(self): |
|
1049 |
# This is nearly like TestResolveNonDirectoryParent but with branch and
|
|
1050 |
# trunk switched. As such it should certainly produce the same
|
|
1051 |
# conflict.
|
|
7490.69.1
by Jelmer Vernooij
Move some more tests to breezy.bzr. |
1052 |
self.assertRaises(transform.MalformedTransform, |
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
1053 |
self.run_script, """ |
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1054 |
$ brz init trunk
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
1055 |
...
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
1056 |
$ cd trunk
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1057 |
$ brz mkdir foo
|
5422.3.4
by Martin Pool
Update test_resolve to pass --quiet or ignore command output it doesn't care about |
1058 |
...
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1059 |
$ brz commit -m 'Create trunk' -q
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
1060 |
$ rm -r foo
|
1061 |
$ echo "Boo!" >foo
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1062 |
$ brz commit -m 'foo is now a file' -q
|
1063 |
$ brz branch -q . -r 1 ../branch -q
|
|
4597.3.15
by Vincent Ladeuil
Update to new shell-like tests syntax. |
1064 |
$ cd ../branch
|
1065 |
$ echo "Boing" >foo/bar
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1066 |
$ brz add -q foo/bar -q
|
1067 |
$ brz commit -m 'Add foo/bar' -q
|
|
1068 |
$ brz merge ../trunk
|
|
1069 |
2>brz: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
|
|
4597.3.12
by Vincent Ladeuil
Start writing tests for all expected conflict resolution actions. |
1070 |
""") |
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1071 |
|
5050.63.2
by Vincent Ladeuil
The file should be in a subdir to reproduce the bug. |
1072 |
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1073 |
class TestNoFinalPath(script.TestCaseWithTransportAndScript): |
1074 |
||
1075 |
def test_bug_805809(self): |
|
1076 |
self.run_script(""" |
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1077 |
$ brz init trunk
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1078 |
Created a standalone tree (format: 2a)
|
1079 |
$ cd trunk
|
|
1080 |
$ echo trunk >file
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1081 |
$ brz add
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1082 |
adding file
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1083 |
$ brz commit -m 'create file on trunk'
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1084 |
2>Committing to: .../trunk/
|
1085 |
2>added file
|
|
1086 |
2>Committed revision 1.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1087 |
# Create a debian branch based on trunk
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1088 |
$ cd ..
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1089 |
$ brz branch trunk -r 1 debian
|
6143.1.4
by Jonathan Riddell
update tests |
1090 |
2>Branched 1 revision.
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1091 |
$ cd debian
|
1092 |
$ mkdir dir
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1093 |
$ brz add
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1094 |
adding dir
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1095 |
$ brz mv file dir
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1096 |
file => dir/file
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1097 |
$ brz commit -m 'rename file to dir/file for debian'
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1098 |
2>Committing to: .../debian/
|
1099 |
2>added dir
|
|
1100 |
2>renamed file => dir/file
|
|
1101 |
2>Committed revision 2.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1102 |
# Create an experimental branch with a new root-id
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1103 |
$ cd ..
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1104 |
$ brz init experimental
|
5609.49.2
by Vincent Ladeuil
Fix pqm failure. |
1105 |
Created a standalone tree (format: 2a)
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1106 |
$ cd experimental
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1107 |
# Work around merging into empty branch not being supported
|
1108 |
# (http://pad.lv/308562)
|
|
1109 |
$ echo something >not-empty
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1110 |
$ brz add
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1111 |
adding not-empty
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1112 |
$ brz commit -m 'Add some content in experimental'
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1113 |
2>Committing to: .../experimental/
|
1114 |
2>added not-empty
|
|
1115 |
2>Committed revision 1.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1116 |
# merge debian even without a common ancestor
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1117 |
$ brz merge ../debian -r0..2
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1118 |
2>+N dir/
|
1119 |
2>+N dir/file
|
|
1120 |
2>All changes applied successfully.
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1121 |
$ brz commit -m 'merging debian into experimental'
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1122 |
2>Committing to: .../experimental/
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1123 |
2>added dir
|
1124 |
2>added dir/file
|
|
1125 |
2>Committed revision 2.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1126 |
# Create an ubuntu branch with yet another root-id
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1127 |
$ cd ..
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1128 |
$ brz init ubuntu
|
5609.49.2
by Vincent Ladeuil
Fix pqm failure. |
1129 |
Created a standalone tree (format: 2a)
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1130 |
$ cd ubuntu
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1131 |
# Work around merging into empty branch not being supported
|
1132 |
# (http://pad.lv/308562)
|
|
1133 |
$ echo something >not-empty-ubuntu
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1134 |
$ brz add
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1135 |
adding not-empty-ubuntu
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1136 |
$ brz commit -m 'Add some content in experimental'
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1137 |
2>Committing to: .../ubuntu/
|
1138 |
2>added not-empty-ubuntu
|
|
1139 |
2>Committed revision 1.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1140 |
# Also merge debian
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1141 |
$ brz merge ../debian -r0..2
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1142 |
2>+N dir/
|
1143 |
2>+N dir/file
|
|
1144 |
2>All changes applied successfully.
|
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1145 |
$ brz commit -m 'merging debian'
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1146 |
2>Committing to: .../ubuntu/
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1147 |
2>added dir
|
1148 |
2>added dir/file
|
|
1149 |
2>Committed revision 2.
|
|
5050.73.7
by Vincent Ladeuil
Slightly simpler test. |
1150 |
# Now try to merge experimental
|
6622.1.33
by Jelmer Vernooij
Fix more tests (all?) |
1151 |
$ brz merge ../experimental
|
5050.73.13
by Vincent Ladeuil
Fix the test for trunk where merging into an empty branch now behave differently |
1152 |
2>+N not-empty
|
5050.73.6
by Vincent Ladeuil
Reproduce bug #805809. |
1153 |
2>Path conflict: dir / dir
|
1154 |
2>1 conflicts encountered.
|
|
1155 |
""") |
|
1156 |
||
1157 |
||
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1158 |
class TestResolveActionOption(tests.TestCase): |
1159 |
||
1160 |
def setUp(self): |
|
1161 |
super(TestResolveActionOption, self).setUp() |
|
1162 |
self.options = [conflicts.ResolveActionOption()] |
|
7045.4.23
by Jelmer Vernooij
Fix some help tests. |
1163 |
self.parser = option.get_optparser(self.options) |
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1164 |
|
1165 |
def parse(self, args): |
|
1166 |
return self.parser.parse_args(args) |
|
1167 |
||
1168 |
def test_unknown_action(self): |
|
6731.1.4
by Jelmer Vernooij
Move BadOptionValue to breezy.option. |
1169 |
self.assertRaises(option.BadOptionValue, |
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1170 |
self.parse, ['--action', 'take-me-to-the-moon']) |
1171 |
||
1172 |
def test_done(self): |
|
1173 |
opts, args = self.parse(['--action', 'done']) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1174 |
self.assertEqual({'action': 'done'}, opts) |
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1175 |
|
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1176 |
def test_take_this(self): |
1177 |
opts, args = self.parse(['--action', 'take-this']) |
|
1178 |
self.assertEqual({'action': 'take_this'}, opts) |
|
1179 |
opts, args = self.parse(['--take-this']) |
|
1180 |
self.assertEqual({'action': 'take_this'}, opts) |
|
4597.3.51
by Vincent Ladeuil
Implement conflicts.ResolveActionOption. |
1181 |
|
4597.3.67
by Vincent Ladeuil
Settle with --take-this and --take-other as action names. |
1182 |
def test_take_other(self): |
1183 |
opts, args = self.parse(['--action', 'take-other']) |
|
1184 |
self.assertEqual({'action': 'take_other'}, opts) |
|
1185 |
opts, args = self.parse(['--take-other']) |
|
1186 |
self.assertEqual({'action': 'take_other'}, opts) |