bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
1  | 
# Copyright (C) 2005, 2006, 2007, 2008, 2009 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  | 
||
18  | 
import os  | 
|
19  | 
||
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
20  | 
from bzrlib import (  | 
21  | 
bzrdir,  | 
|
22  | 
conflicts,  | 
|
23  | 
errors,  | 
|
| 
4597.3.51
by Vincent Ladeuil
 Implement conflicts.ResolveActionOption.  | 
24  | 
option,  | 
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
25  | 
tests,  | 
26  | 
    )
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
27  | 
from bzrlib.tests import script  | 
| 
1185.14.8
by Aaron Bentley
 Added test_commit.py  | 
28  | 
|
| 
1534.10.4
by Aaron Bentley
 Implemented conflict serialization  | 
29  | 
|
| 
1185.14.8
by Aaron Bentley
 Added test_commit.py  | 
30  | 
# 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.  | 
31  | 
# RBC 20060124 is that not tested in test_commit.py ?
 | 
| 
1185.14.8
by Aaron Bentley
 Added test_commit.py  | 
32  | 
|
| 
1666.1.4
by Robert Collins
 * 'Metadir' is now the default disk format. This improves behaviour in  | 
33  | 
# The order of 'path' here is important - do not let it
 | 
34  | 
# 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.  | 
35  | 
# u'\xe5' == a with circle
 | 
36  | 
# '\xc3\xae' == u'\xee' == i with hat
 | 
|
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
37  | 
# So these are u'path' and 'id' only with a circle and a hat. (shappo?)
 | 
38  | 
example_conflicts = conflicts.ConflictList(  | 
|
39  | 
[conflicts.MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),  | 
|
40  | 
conflicts.ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),  | 
|
41  | 
conflicts.TextConflict(u'p\xe5tha'),  | 
|
42  | 
conflicts.PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),  | 
|
43  | 
conflicts.DuplicateID('Unversioned existing file',  | 
|
44  | 
u'p\xe5thc', u'p\xe5thc2',  | 
|
45  | 
'\xc3\xaedc', '\xc3\xaedc'),  | 
|
46  | 
conflicts.DuplicateEntry('Moved existing file to',  | 
|
47  | 
u'p\xe5thdd.moved', u'p\xe5thd',  | 
|
48  | 
'\xc3\xaedd', None),  | 
|
49  | 
conflicts.ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',  | 
|
50  | 
None, '\xc3\xaed2e'),  | 
|
51  | 
conflicts.UnversionedParent('Versioned directory',  | 
|
52  | 
u'p\xe5thf', '\xc3\xaedf'),  | 
|
53  | 
conflicts.NonDirectoryParent('Created directory',  | 
|
54  | 
u'p\xe5thg', '\xc3\xaedg'),  | 
|
| 
1534.10.22
by Aaron Bentley
 Got ConflictList implemented  | 
55  | 
])
 | 
| 
1534.10.4
by Aaron Bentley
 Implemented conflict serialization  | 
56  | 
|
57  | 
||
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
58  | 
class TestConflicts(tests.TestCaseWithTransport):  | 
| 
1185.14.8
by Aaron Bentley
 Added test_commit.py  | 
59  | 
|
60  | 
def test_conflicts(self):  | 
|
61  | 
"""Conflicts are detected properly"""  | 
|
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
62  | 
        # Use BzrDirFormat6 so we can fake conflicts
 | 
63  | 
tree = self.make_branch_and_tree('.', format=bzrdir.BzrDirFormat6())  | 
|
64  | 
self.build_tree_contents([('hello', 'hello world4'),  | 
|
65  | 
('hello.THIS', 'hello world2'),  | 
|
66  | 
('hello.BASE', 'hello world1'),  | 
|
67  | 
('hello.OTHER', 'hello world3'),  | 
|
68  | 
('hello.sploo.BASE', 'yellowworld'),  | 
|
69  | 
('hello.sploo.OTHER', 'yellowworld2'),  | 
|
70  | 
                                  ])
 | 
|
| 
2255.2.61
by John Arbash Meinel
 Find callers of list_files() and make sure the tree is always locked.  | 
71  | 
tree.lock_read()  | 
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
72  | 
self.assertEqual(6, len(list(tree.list_files())))  | 
| 
2255.2.61
by John Arbash Meinel
 Find callers of list_files() and make sure the tree is always locked.  | 
73  | 
tree.unlock()  | 
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
74  | 
tree_conflicts = tree.conflicts()  | 
75  | 
self.assertEqual(2, len(tree_conflicts))  | 
|
76  | 
self.assertTrue('hello' in tree_conflicts[0].path)  | 
|
77  | 
self.assertTrue('hello.sploo' in tree_conflicts[1].path)  | 
|
78  | 
conflicts.restore('hello')  | 
|
79  | 
conflicts.restore('hello.sploo')  | 
|
| 
4597.2.2
by Vincent Ladeuil
 Cleanup conflict tests.  | 
80  | 
self.assertEqual(0, len(tree.conflicts()))  | 
| 
1185.35.1
by Aaron Bentley
 Implemented conflicts.restore  | 
81  | 
self.assertFileEqual('hello world2', 'hello')  | 
| 
3376.2.4
by Martin Pool
 Remove every assert statement from bzrlib!  | 
82  | 
self.assertFalse(os.path.lexists('hello.sploo'))  | 
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
83  | 
self.assertRaises(errors.NotConflicted, conflicts.restore, 'hello')  | 
84  | 
self.assertRaises(errors.NotConflicted,  | 
|
85  | 
conflicts.restore, 'hello.sploo')  | 
|
| 
1534.10.4
by Aaron Bentley
 Implemented conflict serialization  | 
86  | 
|
| 
1558.12.9
by Aaron Bentley
 Handle resolving conflicts with directories properly  | 
87  | 
def test_resolve_conflict_dir(self):  | 
88  | 
tree = self.make_branch_and_tree('.')  | 
|
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
89  | 
self.build_tree_contents([('hello', 'hello world4'),  | 
90  | 
('hello.THIS', 'hello world2'),  | 
|
91  | 
('hello.BASE', 'hello world1'),  | 
|
92  | 
                                  ])
 | 
|
93  | 
os.mkdir('hello.OTHER')  | 
|
| 
1558.12.9
by Aaron Bentley
 Handle resolving conflicts with directories properly  | 
94  | 
tree.add('hello', 'q')  | 
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
95  | 
l = conflicts.ConflictList([conflicts.TextConflict('hello')])  | 
| 
1558.12.9
by Aaron Bentley
 Handle resolving conflicts with directories properly  | 
96  | 
l.remove_files(tree)  | 
97  | 
||
| 
1551.15.58
by Aaron Bentley
 Status honours selected paths for conflicts (#127606)  | 
98  | 
def test_select_conflicts(self):  | 
99  | 
tree = self.make_branch_and_tree('.')  | 
|
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
100  | 
clist = conflicts.ConflictList  | 
101  | 
||
102  | 
def check_select(not_selected, selected, paths, **kwargs):  | 
|
103  | 
self.assertEqual(  | 
|
104  | 
(not_selected, selected),  | 
|
105  | 
tree_conflicts.select_conflicts(tree, paths, **kwargs))  | 
|
106  | 
||
107  | 
foo = conflicts.ContentsConflict('foo')  | 
|
108  | 
bar = conflicts.ContentsConflict('bar')  | 
|
109  | 
tree_conflicts = clist([foo, bar])  | 
|
110  | 
||
111  | 
check_select(clist([bar]), clist([foo]), ['foo'])  | 
|
112  | 
check_select(clist(), tree_conflicts,  | 
|
113  | 
[''], ignore_misses=True, recurse=True)  | 
|
114  | 
||
115  | 
foobaz = conflicts.ContentsConflict('foo/baz')  | 
|
116  | 
tree_conflicts = clist([foobaz, bar])  | 
|
117  | 
||
118  | 
check_select(clist([bar]), clist([foobaz]),  | 
|
119  | 
['foo'], ignore_misses=True, recurse=True)  | 
|
120  | 
||
121  | 
qux = conflicts.PathConflict('qux', 'foo/baz')  | 
|
122  | 
tree_conflicts = clist([qux])  | 
|
123  | 
||
124  | 
check_select(clist(), tree_conflicts,  | 
|
125  | 
['foo'], ignore_misses=True, recurse=True)  | 
|
126  | 
check_select (tree_conflicts, clist(), ['foo'], ignore_misses=True)  | 
|
| 
1551.15.58
by Aaron Bentley
 Status honours selected paths for conflicts (#127606)  | 
127  | 
|
| 
3017.2.1
by Aaron Bentley
 Revert now resolves conflicts recursively (#102739)  | 
128  | 
def test_resolve_conflicts_recursive(self):  | 
129  | 
tree = self.make_branch_and_tree('.')  | 
|
130  | 
self.build_tree(['dir/', 'dir/hello'])  | 
|
131  | 
tree.add(['dir', 'dir/hello'])  | 
|
| 
4597.2.3
by Vincent Ladeuil
 More cleanup.  | 
132  | 
|
133  | 
dirhello = conflicts.ConflictList([conflicts.TextConflict('dir/hello')])  | 
|
134  | 
tree.set_conflicts(dirhello)  | 
|
135  | 
||
136  | 
conflicts.resolve(tree, ['dir'], recursive=False, ignore_misses=True)  | 
|
137  | 
self.assertEqual(dirhello, tree.conflicts())  | 
|
138  | 
||
139  | 
conflicts.resolve(tree, ['dir'], recursive=True, ignore_misses=True)  | 
|
140  | 
self.assertEqual(conflicts.ConflictList([]), tree.conflicts())  | 
|
| 
4773.1.1
by Vincent Ladeuil
 Cleanup imports in test_conflicts  | 
141  | 
|
142  | 
||
| 
4597.3.43
by Vincent Ladeuil
 Cleanups, ready to record.  | 
143  | 
class TestConflictStanzas(tests.TestCase):  | 
144  | 
||
145  | 
def test_stanza_roundtrip(self):  | 
|
146  | 
        # write and read our example stanza.
 | 
|
147  | 
stanza_iter = example_conflicts.to_stanzas()  | 
|
148  | 
processed = conflicts.ConflictList.from_stanzas(stanza_iter)  | 
|
149  | 
for o, p in zip(processed, example_conflicts):  | 
|
150  | 
self.assertEqual(o, p)  | 
|
151  | 
||
152  | 
self.assertIsInstance(o.path, unicode)  | 
|
153  | 
||
154  | 
if o.file_id is not None:  | 
|
155  | 
self.assertIsInstance(o.file_id, str)  | 
|
156  | 
||
157  | 
conflict_path = getattr(o, 'conflict_path', None)  | 
|
158  | 
if conflict_path is not None:  | 
|
159  | 
self.assertIsInstance(conflict_path, unicode)  | 
|
160  | 
||
161  | 
conflict_file_id = getattr(o, 'conflict_file_id', None)  | 
|
162  | 
if conflict_file_id is not None:  | 
|
163  | 
self.assertIsInstance(conflict_file_id, str)  | 
|
164  | 
||
165  | 
def test_stanzification(self):  | 
|
166  | 
for stanza in example_conflicts.to_stanzas():  | 
|
167  | 
if 'file_id' in stanza:  | 
|
168  | 
                # In Stanza form, the file_id has to be unicode.
 | 
|
169  | 
self.assertStartsWith(stanza['file_id'], u'\xeed')  | 
|
170  | 
self.assertStartsWith(stanza['path'], u'p\xe5th')  | 
|
171  | 
if 'conflict_path' in stanza:  | 
|
172  | 
self.assertStartsWith(stanza['conflict_path'], u'p\xe5th')  | 
|
173  | 
if 'conflict_file_id' in stanza:  | 
|
174  | 
self.assertStartsWith(stanza['conflict_file_id'], u'\xeed')  | 
|
175  | 
||
176  | 
||
| 
4597.3.74
by Vincent Ladeuil
 Add a FIXME about rewriting shell-like tests into real whitebox tests.  | 
177  | 
# FIXME: The shell-like tests should be converted to real whitebox tests... or
 | 
178  | 
# moved to a blackbox module -- vila 20100205
 | 
|
179  | 
||
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
180  | 
# FIXME: Tests missing for DuplicateID conflict type
 | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
181  | 
class TestResolveConflicts(script.TestCaseWithTransportAndScript):  | 
182  | 
||
183  | 
preamble = None # The setup script set by daughter classes  | 
|
184  | 
||
185  | 
def setUp(self):  | 
|
186  | 
super(TestResolveConflicts, self).setUp()  | 
|
187  | 
self.run_script(self.preamble)  | 
|
188  | 
||
189  | 
||
190  | 
class TestResolveTextConflicts(TestResolveConflicts):  | 
|
191  | 
    # TBC
 | 
|
192  | 
    pass
 | 
|
193  | 
||
194  | 
||
195  | 
class TestResolveContentConflicts(TestResolveConflicts):  | 
|
196  | 
||
197  | 
    # FIXME: We need to add the reverse case (delete in trunk, modify in
 | 
|
198  | 
    # branch) but that could wait until the resolution mechanism is implemented.
 | 
|
199  | 
||
200  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
201  | 
$ bzr init trunk
 | 
202  | 
$ cd trunk
 | 
|
203  | 
$ echo 'trunk content' >file
 | 
|
204  | 
$ bzr add file
 | 
|
205  | 
$ bzr commit -m 'Create trunk'
 | 
|
206  | 
||
207  | 
$ bzr branch . ../branch
 | 
|
208  | 
$ cd ../branch
 | 
|
209  | 
$ bzr rm file
 | 
|
210  | 
$ bzr commit -m 'Delete file'
 | 
|
211  | 
||
212  | 
$ cd ../trunk
 | 
|
213  | 
$ echo 'more content' >>file
 | 
|
214  | 
$ bzr commit -m 'Modify file'
 | 
|
215  | 
||
216  | 
$ cd ../branch
 | 
|
217  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
218  | 
2>+N  file.OTHER
 | 
219  | 
2>Contents conflict in file
 | 
|
220  | 
2>1 conflicts encountered.
 | 
|
221  | 
"""
 | 
|
222  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
223  | 
def test_take_this(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
224  | 
self.run_script("""  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
225  | 
$ bzr rm file.OTHER --force # a simple rm file.OTHER is valid too
 | 
226  | 
$ bzr resolve file
 | 
|
227  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
228  | 
""")  | 
229  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
230  | 
def test_take_other(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
231  | 
self.run_script("""  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
232  | 
$ bzr mv file.OTHER file
 | 
233  | 
$ bzr resolve file
 | 
|
234  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
235  | 
""")  | 
236  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
237  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.28
by Vincent Ladeuil
 Implement --interactive for ContentsConflict.  | 
238  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
239  | 
$ bzr resolve --take-this file
 | 
| 
4597.3.28
by Vincent Ladeuil
 Implement --interactive for ContentsConflict.  | 
240  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
241  | 
""")  | 
|
242  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
243  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.28
by Vincent Ladeuil
 Implement --interactive for ContentsConflict.  | 
244  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
245  | 
$ bzr resolve --take-other file
 | 
| 
4597.3.28
by Vincent Ladeuil
 Implement --interactive for ContentsConflict.  | 
246  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
247  | 
""")  | 
|
248  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
249  | 
|
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
250  | 
class TestResolveDuplicateEntry(TestResolveConflicts):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
251  | 
|
252  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
253  | 
$ bzr init trunk
 | 
254  | 
$ cd trunk
 | 
|
255  | 
$ echo 'trunk content' >file
 | 
|
256  | 
$ bzr add file
 | 
|
257  | 
$ bzr commit -m 'Create trunk'
 | 
|
258  | 
$ echo 'trunk content too' >file2
 | 
|
259  | 
$ bzr add file2
 | 
|
260  | 
$ bzr commit -m 'Add file2 in trunk'
 | 
|
261  | 
||
262  | 
$ bzr branch . -r 1 ../branch
 | 
|
263  | 
$ cd ../branch
 | 
|
264  | 
$ echo 'branch content' >file2
 | 
|
265  | 
$ bzr add file2
 | 
|
266  | 
$ bzr commit -m 'Add file2 in branch'
 | 
|
267  | 
||
268  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
269  | 
2>+N  file2
 | 
270  | 
2>R   file2 => file2.moved
 | 
|
271  | 
2>Conflict adding file file2.  Moved existing file to file2.moved.
 | 
|
272  | 
2>1 conflicts encountered.
 | 
|
273  | 
"""
 | 
|
274  | 
||
275  | 
def test_keep_this(self):  | 
|
276  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
277  | 
$ bzr rm file2  --force
 | 
278  | 
$ bzr mv file2.moved file2
 | 
|
279  | 
$ bzr resolve file2
 | 
|
280  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
281  | 
""")  | 
282  | 
||
283  | 
def test_keep_other(self):  | 
|
284  | 
self.failIfExists('branch/file2.moved')  | 
|
285  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
286  | 
$ bzr rm file2.moved --force
 | 
287  | 
$ bzr resolve file2
 | 
|
288  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
289  | 
""")  | 
290  | 
self.failIfExists('branch/file2.moved')  | 
|
291  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
292  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.19
by Vincent Ladeuil
 Some failing tests.  | 
293  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
294  | 
$ bzr resolve --take-this file2
 | 
| 
4597.3.19
by Vincent Ladeuil
 Some failing tests.  | 
295  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
296  | 
""")  | 
|
297  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
298  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.19
by Vincent Ladeuil
 Some failing tests.  | 
299  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
300  | 
$ bzr resolve --take-other file2
 | 
| 
4597.3.19
by Vincent Ladeuil
 Some failing tests.  | 
301  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
302  | 
""")  | 
|
303  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
304  | 
|
305  | 
class TestResolveUnversionedParent(TestResolveConflicts):  | 
|
306  | 
||
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
307  | 
    # FIXME: Add the reverse tests: dir deleted in trunk, file added in branch
 | 
308  | 
||
| 
4597.3.30
by Vincent Ladeuil
 Light changes learned while starting to understand multiple conflicts on  | 
309  | 
    # FIXME: While this *creates* UnversionedParent conflicts, this really only
 | 
310  | 
    # tests MissingParent resolution :-/
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
311  | 
preamble = """  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
312  | 
$ bzr init trunk
 | 
313  | 
$ cd trunk
 | 
|
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
314  | 
$ mkdir dir
 | 
315  | 
$ bzr add dir
 | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
316  | 
$ bzr commit -m 'Create trunk'
 | 
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
317  | 
$ echo 'trunk content' >dir/file
 | 
318  | 
$ bzr add dir/file
 | 
|
319  | 
$ bzr commit -m 'Add dir/file in trunk'
 | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
320  | 
|
321  | 
$ bzr branch . -r 1 ../branch
 | 
|
322  | 
$ cd ../branch
 | 
|
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
323  | 
$ bzr rm dir
 | 
324  | 
$ bzr commit -m 'Remove dir in branch'
 | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
325  | 
|
326  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
327  | 
2>+N  dir/
 | 
328  | 
2>+N  dir/file
 | 
|
329  | 
2>Conflict adding files to dir.  Created directory.
 | 
|
330  | 
2>Conflict because dir is not versioned, but has versioned children.  Versioned directory.
 | 
|
331  | 
2>2 conflicts encountered.
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
332  | 
"""
 | 
333  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
334  | 
def test_take_this(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
335  | 
self.run_script("""  | 
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
336  | 
$ bzr rm dir  --force
 | 
337  | 
$ bzr resolve dir
 | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
338  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
339  | 
""")  | 
340  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
341  | 
def test_take_other(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
342  | 
self.run_script("""  | 
| 
4597.3.29
by Vincent Ladeuil
 Fix bogus tests.  | 
343  | 
$ bzr resolve dir
 | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
344  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
345  | 
""")  | 
346  | 
||
347  | 
||
348  | 
class TestResolveMissingParent(TestResolveConflicts):  | 
|
349  | 
||
350  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
351  | 
$ bzr init trunk
 | 
352  | 
$ cd trunk
 | 
|
353  | 
$ mkdir dir
 | 
|
354  | 
$ echo 'trunk content' >dir/file
 | 
|
355  | 
$ bzr add
 | 
|
356  | 
$ bzr commit -m 'Create trunk'
 | 
|
357  | 
$ echo 'trunk content' >dir/file2
 | 
|
358  | 
$ bzr add dir/file2
 | 
|
359  | 
$ bzr commit -m 'Add dir/file2 in branch'
 | 
|
360  | 
||
361  | 
$ bzr branch . -r 1 ../branch
 | 
|
362  | 
$ cd ../branch
 | 
|
363  | 
$ bzr rm dir/file --force
 | 
|
364  | 
$ bzr rm dir
 | 
|
365  | 
$ bzr commit -m 'Remove dir/file'
 | 
|
366  | 
||
367  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
368  | 
2>+N  dir/
 | 
369  | 
2>+N  dir/file2
 | 
|
370  | 
2>Conflict adding files to dir.  Created directory.
 | 
|
371  | 
2>Conflict because dir is not versioned, but has versioned children.  Versioned directory.
 | 
|
372  | 
2>2 conflicts encountered.
 | 
|
373  | 
"""
 | 
|
374  | 
||
375  | 
def test_keep_them_all(self):  | 
|
376  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
377  | 
$ bzr resolve dir
 | 
378  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
379  | 
""")  | 
380  | 
||
381  | 
def test_adopt_child(self):  | 
|
382  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
383  | 
$ bzr mv dir/file2 file2
 | 
384  | 
$ bzr rm dir --force
 | 
|
385  | 
$ bzr resolve dir
 | 
|
386  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
387  | 
""")  | 
388  | 
||
389  | 
def test_kill_them_all(self):  | 
|
390  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
391  | 
$ bzr rm dir --force
 | 
392  | 
$ bzr resolve dir
 | 
|
393  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
394  | 
""")  | 
395  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
396  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
397  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
398  | 
$ bzr resolve --take-this dir
 | 
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
399  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
400  | 
""")  | 
|
401  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
402  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
403  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
404  | 
$ bzr resolve --take-other dir
 | 
| 
4597.3.31
by Vincent Ladeuil
 Implement --interactive for MissingParent.  | 
405  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
406  | 
""")  | 
|
407  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
408  | 
|
409  | 
class TestResolveDeletingParent(TestResolveConflicts):  | 
|
410  | 
||
411  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
412  | 
$ bzr init trunk
 | 
413  | 
$ cd trunk
 | 
|
414  | 
$ mkdir dir
 | 
|
415  | 
$ echo 'trunk content' >dir/file
 | 
|
416  | 
$ bzr add
 | 
|
417  | 
$ bzr commit -m 'Create trunk'
 | 
|
418  | 
$ bzr rm dir/file --force
 | 
|
419  | 
$ bzr rm dir --force
 | 
|
420  | 
$ bzr commit -m 'Remove dir/file'
 | 
|
421  | 
||
422  | 
$ bzr branch . -r 1 ../branch
 | 
|
423  | 
$ cd ../branch
 | 
|
424  | 
$ echo 'branch content' >dir/file2
 | 
|
425  | 
$ bzr add dir/file2
 | 
|
426  | 
$ bzr commit -m 'Add dir/file2 in branch'
 | 
|
427  | 
||
428  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
429  | 
2>-D  dir/file
 | 
430  | 
2>Conflict: can't delete dir because it is not empty.  Not deleting.
 | 
|
431  | 
2>Conflict because dir is not versioned, but has versioned children.  Versioned directory.
 | 
|
432  | 
2>2 conflicts encountered.
 | 
|
433  | 
"""
 | 
|
434  | 
||
435  | 
def test_keep_them_all(self):  | 
|
436  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
437  | 
$ bzr resolve dir
 | 
438  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
439  | 
""")  | 
440  | 
||
441  | 
def test_adopt_child(self):  | 
|
442  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
443  | 
$ bzr mv dir/file2 file2
 | 
444  | 
$ bzr rm dir --force
 | 
|
445  | 
$ bzr resolve dir
 | 
|
446  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
447  | 
""")  | 
448  | 
||
449  | 
def test_kill_them_all(self):  | 
|
450  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
451  | 
$ bzr rm dir --force
 | 
452  | 
$ bzr resolve dir
 | 
|
453  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
454  | 
""")  | 
455  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
456  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.32
by Vincent Ladeuil
 Implement --interactive for DeletingParent noting the inconsistency.  | 
457  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
458  | 
$ bzr resolve --take-this dir
 | 
| 
4597.3.32
by Vincent Ladeuil
 Implement --interactive for DeletingParent noting the inconsistency.  | 
459  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
460  | 
""")  | 
|
461  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
462  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.32
by Vincent Ladeuil
 Implement --interactive for DeletingParent noting the inconsistency.  | 
463  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
464  | 
$ bzr resolve --take-other dir
 | 
| 
4597.3.32
by Vincent Ladeuil
 Implement --interactive for DeletingParent noting the inconsistency.  | 
465  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
466  | 
""")  | 
|
467  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
468  | 
|
469  | 
class TestResolvePathConflict(TestResolveConflicts):  | 
|
470  | 
||
471  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
472  | 
$ bzr init trunk
 | 
473  | 
$ cd trunk
 | 
|
474  | 
$ echo 'Boo!' >file
 | 
|
475  | 
$ bzr add
 | 
|
476  | 
$ bzr commit -m 'Create trunk'
 | 
|
477  | 
$ bzr mv file file-in-trunk
 | 
|
478  | 
$ bzr commit -m 'Renamed to file-in-trunk'
 | 
|
479  | 
||
480  | 
$ bzr branch . -r 1 ../branch
 | 
|
481  | 
$ cd ../branch
 | 
|
482  | 
$ bzr mv file file-in-branch
 | 
|
483  | 
$ bzr commit -m 'Renamed to file-in-branch'
 | 
|
484  | 
||
485  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
486  | 
2>R   file-in-branch => file-in-trunk
 | 
487  | 
2>Path conflict: file-in-branch / file-in-trunk
 | 
|
488  | 
2>1 conflicts encountered.
 | 
|
489  | 
"""
 | 
|
490  | 
||
491  | 
def test_keep_source(self):  | 
|
492  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
493  | 
$ bzr resolve file-in-trunk
 | 
494  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
495  | 
""")  | 
496  | 
||
497  | 
def test_keep_target(self):  | 
|
498  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
499  | 
$ bzr mv file-in-trunk file-in-branch
 | 
500  | 
$ bzr resolve file-in-branch
 | 
|
501  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
502  | 
""")  | 
503  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
504  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.33
by Vincent Ladeuil
 Implement --interactive for PathConflict.  | 
505  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
506  | 
$ bzr resolve --take-this file-in-branch
 | 
| 
4597.3.33
by Vincent Ladeuil
 Implement --interactive for PathConflict.  | 
507  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
508  | 
""")  | 
|
509  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
510  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.33
by Vincent Ladeuil
 Implement --interactive for PathConflict.  | 
511  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
512  | 
$ bzr resolve --take-other file-in-branch
 | 
| 
4597.3.33
by Vincent Ladeuil
 Implement --interactive for PathConflict.  | 
513  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
514  | 
""")  | 
|
515  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
516  | 
|
517  | 
class TestResolveParentLoop(TestResolveConflicts):  | 
|
518  | 
||
519  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
520  | 
$ bzr init trunk
 | 
521  | 
$ cd trunk
 | 
|
522  | 
$ bzr mkdir dir1
 | 
|
523  | 
$ bzr mkdir dir2
 | 
|
524  | 
$ bzr commit -m 'Create trunk'
 | 
|
525  | 
$ bzr mv dir2 dir1
 | 
|
526  | 
$ bzr commit -m 'Moved dir2 into dir1'
 | 
|
527  | 
||
528  | 
$ bzr branch . -r 1 ../branch
 | 
|
529  | 
$ cd ../branch
 | 
|
530  | 
$ bzr mv dir1 dir2
 | 
|
531  | 
$ bzr commit -m 'Moved dir1 into dir2'
 | 
|
532  | 
||
533  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
534  | 
2>Conflict moving dir2/dir1 into dir2.  Cancelled move.
 | 
535  | 
2>1 conflicts encountered.
 | 
|
536  | 
"""
 | 
|
537  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
538  | 
def test_take_this(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
539  | 
self.run_script("""  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
540  | 
$ bzr resolve dir2
 | 
541  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
542  | 
""")  | 
543  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
544  | 
def test_take_other(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
545  | 
self.run_script("""  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
546  | 
$ bzr mv dir2/dir1 dir1
 | 
547  | 
$ bzr mv dir2 dir1
 | 
|
548  | 
$ bzr resolve dir2
 | 
|
549  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
550  | 
""")  | 
551  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
552  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
553  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
554  | 
$ bzr resolve --take-this dir2
 | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
555  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
556  | 
""")  | 
|
| 
4597.3.64
by Vincent Ladeuil
 Fixed as per Aaron's remark.  | 
557  | 
self.failUnlessExists('dir2')  | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
558  | 
|
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
559  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
560  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
561  | 
$ bzr resolve --take-other dir2
 | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
562  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
563  | 
""")  | 
|
| 
4597.3.64
by Vincent Ladeuil
 Fixed as per Aaron's remark.  | 
564  | 
self.failUnlessExists('dir1')  | 
| 
4597.3.34
by Vincent Ladeuil
 Implement --interactive for ParentLoop.  | 
565  | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
566  | 
|
567  | 
class TestResolveNonDirectoryParent(TestResolveConflicts):  | 
|
568  | 
||
569  | 
preamble = """  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
570  | 
$ bzr init trunk
 | 
571  | 
$ cd trunk
 | 
|
572  | 
$ bzr mkdir foo
 | 
|
573  | 
$ bzr commit -m 'Create trunk'
 | 
|
574  | 
$ echo "Boing" >foo/bar
 | 
|
575  | 
$ bzr add foo/bar
 | 
|
576  | 
$ bzr commit -m 'Add foo/bar'
 | 
|
577  | 
||
578  | 
$ bzr branch . -r 1 ../branch
 | 
|
579  | 
$ cd ../branch
 | 
|
580  | 
$ rm -r foo
 | 
|
581  | 
$ echo "Boo!" >foo
 | 
|
582  | 
$ bzr commit -m 'foo is now a file'
 | 
|
583  | 
||
584  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
585  | 
2>+N  foo.new/bar
 | 
586  | 
2>RK  foo => foo.new/
 | 
|
587  | 
# FIXME: The message is misleading, foo.new *is* a directory when the message
 | 
|
588  | 
# is displayed -- vila 090916
 | 
|
589  | 
2>Conflict: foo.new is not a directory, but has files in it.  Created directory.
 | 
|
590  | 
2>1 conflicts encountered.
 | 
|
591  | 
"""
 | 
|
592  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
593  | 
def test_take_this(self):  | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
594  | 
self.run_script("""  | 
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
595  | 
$ bzr rm foo.new --force
 | 
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
596  | 
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
 | 
597  | 
# aside ? -- vila 090916
 | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
598  | 
$ bzr add foo
 | 
599  | 
$ bzr resolve foo.new
 | 
|
600  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
601  | 
""")  | 
602  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
603  | 
def test_take_other(self):  | 
| 
4597.3.35
by Vincent Ladeuil
 Implement --interactive for NonDirectoryParent, sort of.  | 
604  | 
self.run_script("""  | 
605  | 
$ bzr rm foo --force
 | 
|
606  | 
$ bzr mv foo.new foo
 | 
|
607  | 
$ bzr resolve foo
 | 
|
608  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
|
609  | 
""")  | 
|
610  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
611  | 
def test_resolve_taking_this(self):  | 
| 
4597.3.35
by Vincent Ladeuil
 Implement --interactive for NonDirectoryParent, sort of.  | 
612  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
613  | 
$ bzr resolve --take-this foo.new
 | 
| 
4597.3.35
by Vincent Ladeuil
 Implement --interactive for NonDirectoryParent, sort of.  | 
614  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
615  | 
""")  | 
|
616  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
617  | 
def test_resolve_taking_other(self):  | 
| 
4597.3.35
by Vincent Ladeuil
 Implement --interactive for NonDirectoryParent, sort of.  | 
618  | 
self.run_script("""  | 
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
619  | 
$ bzr resolve --take-other foo.new
 | 
| 
4597.3.35
by Vincent Ladeuil
 Implement --interactive for NonDirectoryParent, sort of.  | 
620  | 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 | 
621  | 
""")  | 
|
622  | 
||
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
623  | 
|
624  | 
class TestMalformedTransform(script.TestCaseWithTransportAndScript):  | 
|
625  | 
||
626  | 
def test_bug_430129(self):  | 
|
627  | 
        # This is nearly like TestResolveNonDirectoryParent but with branch and
 | 
|
628  | 
        # trunk switched. As such it should certainly produce the same
 | 
|
629  | 
        # conflict.
 | 
|
630  | 
self.run_script("""  | 
|
| 
4597.3.15
by Vincent Ladeuil
 Update to new shell-like tests syntax.  | 
631  | 
$ bzr init trunk
 | 
632  | 
$ cd trunk
 | 
|
633  | 
$ bzr mkdir foo
 | 
|
634  | 
$ bzr commit -m 'Create trunk'
 | 
|
635  | 
$ rm -r foo
 | 
|
636  | 
$ echo "Boo!" >foo
 | 
|
637  | 
$ bzr commit -m 'foo is now a file'
 | 
|
638  | 
||
639  | 
$ bzr branch . -r 1 ../branch
 | 
|
640  | 
$ cd ../branch
 | 
|
641  | 
$ echo "Boing" >foo/bar
 | 
|
642  | 
$ bzr add foo/bar
 | 
|
643  | 
$ bzr commit -m 'Add foo/bar'
 | 
|
644  | 
||
645  | 
$ bzr merge ../trunk
 | 
|
| 
4597.3.12
by Vincent Ladeuil
 Start writing tests for all expected conflict resolution actions.  | 
646  | 
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
 | 
647  | 
""")  | 
|
| 
4597.3.51
by Vincent Ladeuil
 Implement conflicts.ResolveActionOption.  | 
648  | 
|
649  | 
||
650  | 
class TestResolveActionOption(tests.TestCase):  | 
|
651  | 
||
652  | 
def setUp(self):  | 
|
653  | 
super(TestResolveActionOption, self).setUp()  | 
|
654  | 
self.options = [conflicts.ResolveActionOption()]  | 
|
655  | 
self.parser = option.get_optparser(dict((o.name, o)  | 
|
656  | 
for o in self.options))  | 
|
657  | 
||
658  | 
def parse(self, args):  | 
|
659  | 
return self.parser.parse_args(args)  | 
|
660  | 
||
661  | 
def test_unknown_action(self):  | 
|
662  | 
self.assertRaises(errors.BadOptionValue,  | 
|
663  | 
self.parse, ['--action', 'take-me-to-the-moon'])  | 
|
664  | 
||
665  | 
def test_done(self):  | 
|
666  | 
opts, args = self.parse(['--action', 'done'])  | 
|
667  | 
self.assertEqual({'action':'done'}, opts)  | 
|
668  | 
||
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
669  | 
def test_take_this(self):  | 
670  | 
opts, args = self.parse(['--action', 'take-this'])  | 
|
671  | 
self.assertEqual({'action': 'take_this'}, opts)  | 
|
672  | 
opts, args = self.parse(['--take-this'])  | 
|
673  | 
self.assertEqual({'action': 'take_this'}, opts)  | 
|
| 
4597.3.51
by Vincent Ladeuil
 Implement conflicts.ResolveActionOption.  | 
674  | 
|
| 
4597.3.67
by Vincent Ladeuil
 Settle with --take-this and --take-other as action names.  | 
675  | 
def test_take_other(self):  | 
676  | 
opts, args = self.parse(['--action', 'take-other'])  | 
|
677  | 
self.assertEqual({'action': 'take_other'}, opts)  | 
|
678  | 
opts, args = self.parse(['--take-other'])  | 
|
679  | 
self.assertEqual({'action': 'take_other'}, opts)  |