/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
4988.10.5 by John Arbash Meinel
Merge bzr.dev 5021 to resolve NEWS
1
# Copyright (C) 2006-2010 Canonical Ltd
1508.1.24 by Robert Collins
Add update command for use with checkouts.
2
# -*- coding: utf-8 -*-
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
3
#
1508.1.24 by Robert Collins
Add update command for use with checkouts.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
8
#
1508.1.24 by Robert Collins
Add update command for use with checkouts.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
13
#
1508.1.24 by Robert Collins
Add update command for use with checkouts.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1508.1.24 by Robert Collins
Add update command for use with checkouts.
17
18
19
"""Tests for the update command of bzr."""
20
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
21
import os
22
import re
23
24
from bzrlib import (
25
    branch,
26
    bzrdir,
27
    osutils,
28
    tests,
29
    urlutils,
30
    workingtree,
31
    )
4916.1.3 by Martin Pool
Change test_update_dash_r to use ScriptRunner and work with current UI
32
from bzrlib.tests.script import ScriptRunner
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
33
34
35
class TestUpdate(tests.TestCaseWithTransport):
1508.1.24 by Robert Collins
Add update command for use with checkouts.
36
37
    def test_update_standalone_trivial(self):
2664.7.2 by Daniel Watkins
tests.blackbox.test_update now uses internals where appropriate.
38
        self.make_branch_and_tree('.')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
39
        out, err = self.run_bzr('update')
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
40
        self.assertEqual(
41
            'Tree is up to date at revision 0 of branch %s\n' % self.test_dir,
42
            err)
4879.1.1 by Neil Martinsen-Burrell
update provides feedback on which branch it is up to date with.
43
        self.assertEqual('', out)
44
45
    def test_update_quiet(self):
46
        self.make_branch_and_tree('.')
47
        out, err = self.run_bzr('update --quiet')
48
        self.assertEqual('', err)
1508.1.24 by Robert Collins
Add update command for use with checkouts.
49
        self.assertEqual('', out)
50
1815.3.4 by Stefan (metze) Metzmacher
add simple test for 'bzr up'
51
    def test_update_standalone_trivial_with_alias_up(self):
2664.7.2 by Daniel Watkins
tests.blackbox.test_update now uses internals where appropriate.
52
        self.make_branch_and_tree('.')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
53
        out, err = self.run_bzr('up')
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
54
        self.assertEqual('Tree is up to date at revision 0 of branch %s\n'
55
                         % self.test_dir,
56
                         err)
1815.3.4 by Stefan (metze) Metzmacher
add simple test for 'bzr up'
57
        self.assertEqual('', out)
58
1587.1.14 by Robert Collins
Make bound branch creation happen via 'checkout'
59
    def test_update_up_to_date_light_checkout(self):
1508.1.24 by Robert Collins
Add update command for use with checkouts.
60
        self.make_branch_and_tree('branch')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
61
        self.run_bzr('checkout --lightweight branch checkout')
62
        out, err = self.run_bzr('update checkout')
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
63
        self.assertEqual('Tree is up to date at revision 0 of branch %s\n'
64
                         % osutils.pathjoin(self.test_dir, 'branch'),
65
                         err)
1830.1.1 by John Arbash Meinel
Print up to date even if bound, also always print out current revno.
66
        self.assertEqual('', out)
67
68
    def test_update_up_to_date_checkout(self):
69
        self.make_branch_and_tree('branch')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
70
        self.run_bzr('checkout branch checkout')
4916.1.11 by Martin Pool
Don't show extra message about updating from master; it's fairly redundant
71
        sr = ScriptRunner()
72
        sr.run_script(self, '''
73
$ bzr update checkout
4916.1.15 by Martin Pool
whitespace correction in test
74
2>Tree is up to date at revision 0 of branch .../branch
4916.1.11 by Martin Pool
Don't show extra message about updating from master; it's fairly redundant
75
''')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
76
77
    def test_update_out_of_date_standalone_tree(self):
78
        # FIXME the default format has to change for this to pass
79
        # because it currently uses the branch last-revision marker.
80
        self.make_branch_and_tree('branch')
81
        # make a checkout
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
82
        self.run_bzr('checkout --lightweight branch checkout')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
83
        self.build_tree(['checkout/file'])
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
84
        self.run_bzr('add checkout/file')
85
        self.run_bzr('commit -m add-file checkout')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
86
        # now branch should be out of date
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
87
        out,err = self.run_bzr('update branch')
1711.2.107 by John Arbash Meinel
re-enable a skipped update test, and clean it up
88
        self.assertEqual('', out)
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
89
        self.assertEqualDiff("""+N  file
90
All changes applied successfully.
91
Updated to revision 1 of branch %s
92
""" % osutils.pathjoin(self.test_dir, 'branch',),
93
                         err)
1508.1.24 by Robert Collins
Add update command for use with checkouts.
94
        self.failUnlessExists('branch/file')
95
1587.1.14 by Robert Collins
Make bound branch creation happen via 'checkout'
96
    def test_update_out_of_date_light_checkout(self):
1508.1.24 by Robert Collins
Add update command for use with checkouts.
97
        self.make_branch_and_tree('branch')
98
        # make two checkouts
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
99
        self.run_bzr('checkout --lightweight branch checkout')
100
        self.run_bzr('checkout --lightweight branch checkout2')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
101
        self.build_tree(['checkout/file'])
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
102
        self.run_bzr('add checkout/file')
103
        self.run_bzr('commit -m add-file checkout')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
104
        # now checkout2 should be out of date
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
105
        out,err = self.run_bzr('update checkout2')
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
106
        self.assertEqualDiff('''+N  file
107
All changes applied successfully.
108
Updated to revision 1 of branch %s
109
''' % osutils.pathjoin(self.test_dir, 'branch',),
110
                         err)
1508.1.24 by Robert Collins
Add update command for use with checkouts.
111
        self.assertEqual('', out)
112
113
    def test_update_conflicts_returns_2(self):
114
        self.make_branch_and_tree('branch')
115
        # make two checkouts
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
116
        self.run_bzr('checkout --lightweight branch checkout')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
117
        self.build_tree(['checkout/file'])
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
118
        self.run_bzr('add checkout/file')
119
        self.run_bzr('commit -m add-file checkout')
120
        self.run_bzr('checkout --lightweight branch checkout2')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
121
        # now alter file in checkout
122
        a_file = file('checkout/file', 'wt')
123
        a_file.write('Foo')
124
        a_file.close()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
125
        self.run_bzr('commit -m checnge-file checkout')
1508.1.24 by Robert Collins
Add update command for use with checkouts.
126
        # now checkout2 should be out of date
127
        # make a local change to file
128
        a_file = file('checkout2/file', 'wt')
129
        a_file.write('Bar')
130
        a_file.close()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
131
        out,err = self.run_bzr('update checkout2', retcode=1)
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
132
        self.assertEqualDiff(''' M  file
133
Text conflict in file
134
1 conflicts encountered.
135
Updated to revision 2 of branch %s
136
''' % osutils.pathjoin(self.test_dir, 'branch',),
137
                         err)
1508.1.24 by Robert Collins
Add update command for use with checkouts.
138
        self.assertEqual('', out)
1587.1.11 by Robert Collins
Local commits appear to be working properly.
139
140
    def test_smoke_update_checkout_bound_branch_local_commits(self):
141
        # smoke test for doing an update of a checkout of a bound
142
        # branch with local commits.
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
143
        master = self.make_branch_and_tree('master')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
144
        # make a bound branch
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
145
        self.run_bzr('checkout master child')
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
146
        # get an object form of child
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
147
        child = workingtree.WorkingTree.open('child')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
148
        # check that out
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
149
        self.run_bzr('checkout --lightweight child checkout')
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
150
        # get an object form of the checkout to manipulate
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
151
        wt = workingtree.WorkingTree.open('checkout')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
152
        # change master
153
        a_file = file('master/file', 'wt')
154
        a_file.write('Foo')
155
        a_file.close()
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
156
        master.add(['file'])
157
        master_tip = master.commit('add file')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
158
        # change child
159
        a_file = file('child/file_b', 'wt')
160
        a_file.write('Foo')
161
        a_file.close()
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
162
        child.add(['file_b'])
163
        child_tip = child.commit('add file_b', local=True)
1587.1.11 by Robert Collins
Local commits appear to be working properly.
164
        # check checkout
165
        a_file = file('checkout/file_c', 'wt')
166
        a_file.write('Foo')
167
        a_file.close()
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
168
        wt.add(['file_c'])
1587.1.11 by Robert Collins
Local commits appear to be working properly.
169
170
        # now, update checkout ->
171
        # get all three files and a pending merge.
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
172
        out, err = self.run_bzr('update checkout')
1711.2.108 by John Arbash Meinel
Assert that update informs the user about where their local commits went.
173
        self.assertEqual('', out)
4985.3.1 by Gerard Krol
Werkt wel ok
174
        self.assertEqualDiff("""+N  file_b
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
175
All changes applied successfully.
4985.3.1 by Gerard Krol
Werkt wel ok
176
+N  file
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
177
All changes applied successfully.
178
Updated to revision 1 of branch %s
179
Your local commits will now show as pending merges with 'bzr status', and can be committed with 'bzr commit'.
180
""" % osutils.pathjoin(self.test_dir, 'master',),
181
                         err)
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
182
        self.assertEqual([master_tip, child_tip], wt.get_parent_ids())
1587.1.11 by Robert Collins
Local commits appear to be working properly.
183
        self.failUnlessExists('checkout/file')
184
        self.failUnlessExists('checkout/file_b')
185
        self.failUnlessExists('checkout/file_c')
186
        self.assertTrue(wt.has_filename('file_c'))
1711.2.109 by John Arbash Meinel
Add a test for handling a pending merge plus an update.
187
188
    def test_update_with_merges(self):
189
        # Test that 'bzr update' works correctly when you have
190
        # an update in the master tree, and a lightweight checkout
191
        # which has merged another branch
192
        master = self.make_branch_and_tree('master')
193
        self.build_tree(['master/file'])
194
        master.add(['file'])
195
        master.commit('one', rev_id='m1')
196
197
        self.build_tree(['checkout1/'])
198
        checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
199
        branch.BranchReferenceFormat().initialize(checkout_dir, master.branch)
200
        checkout1 = checkout_dir.create_workingtree('m1')
201
202
        # Create a second branch, with an extra commit
203
        other = master.bzrdir.sprout('other').open_workingtree()
204
        self.build_tree(['other/file2'])
205
        other.add(['file2'])
206
        other.commit('other2', rev_id='o2')
207
208
        # Create a new commit in the master branch
209
        self.build_tree(['master/file3'])
210
        master.add(['file3'])
211
        master.commit('f3', rev_id='m2')
212
213
        # Merge the other branch into checkout
214
        os.chdir('checkout1')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
215
        self.run_bzr('merge ../other')
1711.2.109 by John Arbash Meinel
Add a test for handling a pending merge plus an update.
216
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
217
        self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
1711.2.109 by John Arbash Meinel
Add a test for handling a pending merge plus an update.
218
219
        # At this point, 'commit' should fail, because we are out of date
220
        self.run_bzr_error(["please run 'bzr update'"],
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
221
                           'commit -m merged')
1711.2.109 by John Arbash Meinel
Add a test for handling a pending merge plus an update.
222
223
        # This should not report about local commits being pending
224
        # merges, because they were real merges
225
        out, err = self.run_bzr('update')
226
        self.assertEqual('', out)
4879.1.3 by Vincent Ladeuil
Cleanup tests and tweak the text displayed.
227
        self.assertEqualDiff('''+N  file3
228
All changes applied successfully.
229
Updated to revision 2 of branch %s
230
''' % osutils.pathjoin(self.test_dir, 'master',),
231
                         err)
1711.2.109 by John Arbash Meinel
Add a test for handling a pending merge plus an update.
232
        # The pending merges should still be there
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
233
        self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
234
2084.2.1 by Aaron Bentley
Support updating lightweight checkouts of readonly branches
235
    def test_readonly_lightweight_update(self):
236
        """Update a light checkout of a readonly branch"""
237
        tree = self.make_branch_and_tree('branch')
238
        readonly_branch = branch.Branch.open(self.get_readonly_url('branch'))
2255.7.55 by Robert Collins
Whitespace fix.
239
        checkout = readonly_branch.create_checkout('checkout',
2084.2.1 by Aaron Bentley
Support updating lightweight checkouts of readonly branches
240
                                                   lightweight=True)
241
        tree.commit('empty commit')
2552.2.2 by Vincent Ladeuil
Enforce run_bzr(string) where possible.
242
        self.run_bzr('update checkout')
2009.1.4 by Mark Hammond
First attempt to merge .dev and resolve the conflicts (but tests are
243
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
244
    def test_update_dash_r(self):
245
        master = self.make_branch_and_tree('master')
246
        os.chdir('master')
247
        self.build_tree(['./file1'])
248
        master.add(['file1'])
249
        master.commit('one', rev_id='m1')
250
        self.build_tree(['./file2'])
251
        master.add(['file2'])
252
        master.commit('two', rev_id='m2')
2009.1.6 by Mark Hammond
more tweaks of the merge to get the tests passing.
253
4985.3.5 by Gerard Krol
Reverting some unneeded changes.
254
        sr = ScriptRunner()
255
        sr.run_script(self, '''
256
$ bzr update -r 1
257
2>-D  file2
258
2>All changes applied successfully.
259
2>Updated to revision 1 of .../master
260
''')
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
261
        self.failUnlessExists('./file1')
262
        self.failIfExists('./file2')
4916.1.4 by Martin Pool
Check tree parent revision after update -r
263
        self.assertEquals(['m1'], master.get_parent_ids())
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
264
265
    def test_update_dash_r_outside_history(self):
266
        master = self.make_branch_and_tree('master')
267
        self.build_tree(['master/file1'])
268
        master.add(['file1'])
269
        master.commit('one', rev_id='m1')
270
271
        # Create a second branch, with an extra commit
272
        other = master.bzrdir.sprout('other').open_workingtree()
273
        self.build_tree(['other/file2'])
274
        other.add(['file2'])
275
        other.commit('other2', rev_id='o2')
276
277
        os.chdir('master')
2009.1.6 by Mark Hammond
more tweaks of the merge to get the tests passing.
278
        self.run_bzr('merge ../other')
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
279
        master.commit('merge', rev_id='merge')
280
2009.1.6 by Mark Hammond
more tweaks of the merge to get the tests passing.
281
        out, err = self.run_bzr('update -r revid:o2',
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
282
                                retcode=3)
283
        self.assertEqual('', out)
284
        self.assertEqual('bzr: ERROR: branch has no revision o2\n'
2009.1.6 by Mark Hammond
more tweaks of the merge to get the tests passing.
285
                         'bzr update --revision only works'
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
286
                         ' for a revision in the branch history\n',
287
                         err)
288
289
    def test_update_dash_r_in_master(self):
290
        # Test that 'bzr update' works correctly when you have
291
        # an update in the master tree,
292
        master = self.make_branch_and_tree('master')
293
        self.build_tree(['master/file1'])
294
        master.add(['file1'])
295
        master.commit('one', rev_id='m1')
296
2009.1.6 by Mark Hammond
more tweaks of the merge to get the tests passing.
297
        self.run_bzr('checkout master checkout')
1907.5.4 by Matthieu Moy
Added test-cases for update -r. Tweaked the implementation too.
298
299
        # add a revision in the master.
300
        self.build_tree(['master/file2'])
301
        master.add(['file2'])
302
        master.commit('two', rev_id='m2')
303
304
        os.chdir('checkout')
4916.1.5 by Martin Pool
Update test_update_dash_r_in_master for ui changes
305
        sr = ScriptRunner()
306
        sr.run_script(self, '''
307
$ bzr update -r revid:m2
308
2>+N  file2
309
2>All changes applied successfully.
310
2>Updated to revision 2 of branch .../master
311
''')
4985.3.1 by Gerard Krol
Werkt wel ok
312
4985.3.9 by Gerard Krol
Use assertFileEqual in the tests, instead of opening them and looking at the contents. TODO: check if this does work on Windows (due to possible \r\n line endings)?
313
    def test_update_checkout_prevent_double_merge(self):
314
        """"Launchpad bug 113809 in bzr "update performs two merges"
315
        https://launchpad.net/bugs/113809"""
4985.3.1 by Gerard Krol
Werkt wel ok
316
        master = self.make_branch_and_tree('master')
4985.3.17 by Vincent Ladeuil
Some cleanup.
317
        self.build_tree_contents([('master/file', 'initial contents\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
318
        master.add(['file'])
319
        master.commit('one', rev_id='m1')
320
321
        checkout = master.branch.create_checkout('checkout')
4985.3.10 by Gerard Krol
Reformat long lines
322
        lightweight = checkout.branch.create_checkout('lightweight',
323
                                                      lightweight=True)
4985.3.17 by Vincent Ladeuil
Some cleanup.
324
4985.3.1 by Gerard Krol
Werkt wel ok
325
        # time to create a mess
326
        # add a commit to the master
4985.3.17 by Vincent Ladeuil
Some cleanup.
327
        self.build_tree_contents([('master/file', 'master\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
328
        master.commit('two', rev_id='m2')
4985.3.17 by Vincent Ladeuil
Some cleanup.
329
        self.build_tree_contents([('master/file', 'master local changes\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
330
331
        # local commit on the checkout
4985.3.17 by Vincent Ladeuil
Some cleanup.
332
        self.build_tree_contents([('checkout/file', 'checkout\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
333
        checkout.commit('tree', rev_id='c2', local=True)
4985.3.17 by Vincent Ladeuil
Some cleanup.
334
        self.build_tree_contents([('checkout/file',
335
                                   'checkout local changes\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
336
337
        # lightweight 
4985.3.10 by Gerard Krol
Reformat long lines
338
        self.build_tree_contents([('lightweight/file',
4985.3.17 by Vincent Ladeuil
Some cleanup.
339
                                   'lightweight local changes\n')])
4985.3.1 by Gerard Krol
Werkt wel ok
340
4985.3.9 by Gerard Krol
Use assertFileEqual in the tests, instead of opening them and looking at the contents. TODO: check if this does work on Windows (due to possible \r\n line endings)?
341
        # now update (and get conflicts)
4985.3.1 by Gerard Krol
Werkt wel ok
342
        out, err = self.run_bzr('update lightweight', retcode=1)
343
        self.assertEqual('', out)
4985.3.17 by Vincent Ladeuil
Some cleanup.
344
        self.assertFileEqual('''\
345
<<<<<<< TREE
346
lightweight local changes
347
=======
348
checkout
349
>>>>>>> MERGE-SOURCE
350
''',
4985.3.10 by Gerard Krol
Reformat long lines
351
                             'lightweight/file')
4985.3.17 by Vincent Ladeuil
Some cleanup.
352
4985.3.1 by Gerard Krol
Werkt wel ok
353
        # resolve it
4985.3.10 by Gerard Krol
Reformat long lines
354
        self.build_tree_contents([('lightweight/file',
4985.3.17 by Vincent Ladeuil
Some cleanup.
355
                                   'lightweight+checkout\n')])
356
        self.run_bzr('resolve lightweight/file')
4985.3.1 by Gerard Krol
Werkt wel ok
357
4985.3.9 by Gerard Krol
Use assertFileEqual in the tests, instead of opening them and looking at the contents. TODO: check if this does work on Windows (due to possible \r\n line endings)?
358
        # check we get the second conflict
4985.3.1 by Gerard Krol
Werkt wel ok
359
        out, err = self.run_bzr('update lightweight', retcode=1)
360
        self.assertEqual('', out)
4985.3.17 by Vincent Ladeuil
Some cleanup.
361
        self.assertFileEqual('''\
362
<<<<<<< TREE
363
lightweight+checkout
364
=======
365
master
366
>>>>>>> MERGE-SOURCE
367
''',
4985.3.10 by Gerard Krol
Reformat long lines
368
                             'lightweight/file')
4985.3.12 by Gerard Krol
Test for a case where update should remove commits
369