83
83
self.run_bzr('add checkout/file')
84
84
self.run_bzr('commit -m add-file checkout')
85
85
# now branch should be out of date
86
out,err = self.run_bzr('update branch')
86
out, err = self.run_bzr('update branch')
87
87
self.assertEqual('', out)
88
88
self.assertEqualDiff("""+N file
89
89
All changes applied successfully.
101
101
self.run_bzr('add checkout/file')
102
102
self.run_bzr('commit -m add-file checkout')
103
103
# now checkout2 should be out of date
104
out,err = self.run_bzr('update checkout2')
104
out, err = self.run_bzr('update checkout2')
105
105
self.assertEqualDiff('''+N file
106
106
All changes applied successfully.
107
107
Updated to revision 1 of branch %s
127
127
a_file = file('checkout2/file', 'wt')
128
128
a_file.write('Bar')
130
out,err = self.run_bzr('update checkout2', retcode=1)
130
out, err = self.run_bzr('update checkout2', retcode=1)
131
131
self.assertEqualDiff(''' M file
132
132
Text conflict in file
133
133
1 conflicts encountered.
192
192
master = self.make_branch_and_tree('master')
193
193
self.build_tree(['master/file'])
194
194
master.add(['file'])
195
master.commit('one', rev_id='m1')
195
master.commit('one', rev_id=b'm1')
197
197
self.build_tree(['checkout1/'])
198
198
checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
203
203
other = master.controldir.sprout('other').open_workingtree()
204
204
self.build_tree(['other/file2'])
205
205
other.add(['file2'])
206
other.commit('other2', rev_id='o2')
206
other.commit('other2', rev_id=b'o2')
208
208
# Create a new commit in the master branch
209
209
self.build_tree(['master/file3'])
210
210
master.add(['file3'])
211
master.commit('f3', rev_id='m2')
211
master.commit('f3', rev_id=b'm2')
213
213
# Merge the other branch into checkout
214
214
os.chdir('checkout1')
248
248
master = self.make_branch_and_tree('master')
249
249
self.build_tree(['master/file'])
250
250
master.add(['file'])
251
master.commit('one', rev_id='m1')
251
master.commit('one', rev_id=b'm1')
253
253
self.build_tree(['checkout1/'])
254
254
checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
259
259
other = master.controldir.sprout('other').open_workingtree()
260
260
self.build_tree(['other/file2'])
261
261
other.add(['file2'])
262
other.commit('other2', rev_id='o2')
262
other.commit('other2', rev_id=b'o2')
264
264
# Merge the other branch into checkout - 'start reviewing a patch'
265
265
checkout1.merge_from_branch(other.branch)
268
268
# Create a new commit in the master branch - 'someone else lands its'
269
269
master.merge_from_branch(other.branch)
270
master.commit('f3', rev_id='m2')
270
master.commit('f3', rev_id=b'm2')
272
272
# This should not report about local commits being pending
273
273
# merges, because they were real merges (but are now gone).
286
286
os.chdir('master')
287
287
self.build_tree(['./file1'])
288
288
master.add(['file1'])
289
master.commit('one', rev_id='m1')
289
master.commit('one', rev_id=b'm1')
290
290
self.build_tree(['./file2'])
291
291
master.add(['file2'])
292
master.commit('two', rev_id='m2')
292
master.commit('two', rev_id=b'm2')
294
294
sr = ScriptRunner()
295
295
sr.run_script(self, '''
308
308
master = self.make_branch_and_tree('master')
309
309
self.build_tree(['master/file1'])
310
310
master.add(['file1'])
311
master.commit('one', rev_id='m1')
311
master.commit('one', rev_id=b'm1')
313
313
# Create a second branch, with extra commits
314
314
other = master.controldir.sprout('other').open_workingtree()
315
315
self.build_tree(['other/file2', 'other/file3'])
316
316
other.add(['file2'])
317
other.commit('other2', rev_id='o2')
317
other.commit('other2', rev_id=b'o2')
318
318
other.add(['file3'])
319
other.commit('other3', rev_id='o3')
319
other.commit('other3', rev_id=b'o3')
321
321
os.chdir('master')
322
322
self.run_bzr('merge ../other')
323
master.commit('merge', rev_id='merge')
323
master.commit('merge', rev_id=b'merge')
325
325
# Switch to o2. file3 was added only in o3 and should be deleted.
326
326
out, err = self.run_bzr('update -r revid:o2')
340
340
master = self.make_branch_and_tree('master')
341
341
self.build_tree(['master/file1'])
342
342
master.add(['file1'])
343
master.commit('one', rev_id='m1')
343
master.commit('one', rev_id=b'm1')
345
345
self.run_bzr('checkout master checkout')
347
347
# add a revision in the master.
348
348
self.build_tree(['master/file2'])
349
349
master.add(['file2'])
350
master.commit('two', rev_id='m2')
350
master.commit('two', rev_id=b'm2')
352
352
os.chdir('checkout')
353
353
sr = ScriptRunner()
366
366
tree=self.make_branch_and_tree('.')
368
f = open('hello','wt')
368
f = open('hello', 'wt')
371
371
tree.add('hello')
372
372
tree.commit('fie')
374
f = open('hello','wt')
374
f = open('hello', 'wt')
377
377
tree.commit('fee')
379
379
#tree.update() gives no such revision, so ...
380
self.run_bzr(['update','-r1'])
380
self.run_bzr(['update', '-r1'])
383
f = open('hello','wt')
383
f = open('hello', 'wt')
387
out, err = self.run_bzr(['update','--show-base'],retcode=1)
387
out, err = self.run_bzr(['update', '--show-base'], retcode=1)
389
389
# check for conflict notification
390
390
self.assertContainsString(err,
400
400
""""Launchpad bug 113809 in brz "update performs two merges"
401
401
https://launchpad.net/bugs/113809"""
402
402
master = self.make_branch_and_tree('master')
403
self.build_tree_contents([('master/file', 'initial contents\n')])
403
self.build_tree_contents([('master/file', b'initial contents\n')])
404
404
master.add(['file'])
405
master.commit('one', rev_id='m1')
405
master.commit('one', rev_id=b'm1')
407
407
checkout = master.branch.create_checkout('checkout')
408
408
lightweight = checkout.branch.create_checkout('lightweight',
411
411
# time to create a mess
412
412
# add a commit to the master
413
self.build_tree_contents([('master/file', 'master\n')])
414
master.commit('two', rev_id='m2')
415
self.build_tree_contents([('master/file', 'master local changes\n')])
413
self.build_tree_contents([('master/file', b'master\n')])
414
master.commit('two', rev_id=b'm2')
415
self.build_tree_contents([('master/file', b'master local changes\n')])
417
417
# local commit on the checkout
418
self.build_tree_contents([('checkout/file', 'checkout\n')])
419
checkout.commit('tree', rev_id='c2', local=True)
418
self.build_tree_contents([('checkout/file', b'checkout\n')])
419
checkout.commit('tree', rev_id=b'c2', local=True)
420
420
self.build_tree_contents([('checkout/file',
421
'checkout local changes\n')])
421
b'checkout local changes\n')])
424
424
self.build_tree_contents([('lightweight/file',
425
'lightweight local changes\n')])
425
b'lightweight local changes\n')])
427
427
# now update (and get conflicts)
428
428
out, err = self.run_bzr('update lightweight', retcode=1)
441
441
self.build_tree_contents([('lightweight/file',
442
'lightweight+checkout\n')])
442
b'lightweight+checkout\n')])
443
443
self.run_bzr('resolve lightweight/file')
445
445
# check we get the second conflict