234
234
self.create_conflicts()
235
235
self.run_bzr('merge ../other --show-base', retcode=1)
236
236
conflict_text = file('hello').read()
237
self.assert_('<<<<<<<' in conflict_text)
238
self.assert_('>>>>>>>' in conflict_text)
239
self.assert_('=======' in conflict_text)
240
self.assert_('|||||||' in conflict_text)
241
self.assert_('hi world' in conflict_text)
237
self.assertTrue('<<<<<<<' in conflict_text)
238
self.assertTrue('>>>>>>>' in conflict_text)
239
self.assertTrue('=======' in conflict_text)
240
self.assertTrue('|||||||' in conflict_text)
241
self.assertTrue('hi world' in conflict_text)
242
242
self.run_bzr('revert')
243
243
self.run_bzr('resolve --all')
244
244
self.run_bzr('merge ../other', retcode=1)
245
245
conflict_text = file('hello').read()
246
self.assert_('|||||||' not in conflict_text)
247
self.assert_('hi world' not in conflict_text)
246
self.assertTrue('|||||||' not in conflict_text)
247
self.assertTrue('hi world' not in conflict_text)
248
248
result = self.run_bzr('conflicts')[0]
249
self.assertEquals(result, "Text conflict in hello\nText conflict in"
249
self.assertEqual(result, "Text conflict in hello\nText conflict in"
251
251
result = self.run_bzr('status')[0]
252
self.assert_("conflicts:\n Text conflict in hello\n"
252
self.assertTrue("conflicts:\n Text conflict in hello\n"
253
253
" Text conflict in question\n" in result, result)
254
254
self.run_bzr('resolve hello')
255
255
result = self.run_bzr('conflicts')[0]
256
self.assertEquals(result, "Text conflict in question\n")
256
self.assertEqual(result, "Text conflict in question\n")
257
257
self.run_bzr('commit -m conflicts', retcode=3)
258
258
self.run_bzr('resolve --all')
259
259
result = self.run_bzr('conflicts')[0]
260
260
self.run_bzr('commit -m conflicts')
261
self.assertEquals(result, "")
261
self.assertEqual(result, "")
263
263
def test_push(self):
264
264
# create a source branch
368
368
f.write('hello world!\n')
371
self.assertEquals(self.run_bzr('unknowns')[0], 'test.txt\n')
371
self.assertEqual(self.run_bzr('unknowns')[0], 'test.txt\n')
373
373
out = self.run_bzr("status")[0]
374
self.assertEquals(out, 'unknown:\n test.txt\n')
374
self.assertEqual(out, 'unknown:\n test.txt\n')
376
376
f = file('test2.txt', 'wt')
377
377
f.write('goodbye cruel world...\n')
380
380
out = self.run_bzr("status test.txt")[0]
381
self.assertEquals(out, "unknown:\n test.txt\n")
381
self.assertEqual(out, "unknown:\n test.txt\n")
383
383
out = self.run_bzr("status")[0]
384
self.assertEquals(out, ("unknown:\n" " test.txt\n" " test2.txt\n"))
384
self.assertEqual(out, ("unknown:\n" " test.txt\n" " test2.txt\n"))
386
386
os.unlink('test2.txt')
388
388
progress("command aliases")
389
389
out = self.run_bzr("st")[0]
390
self.assertEquals(out, ("unknown:\n" " test.txt\n"))
390
self.assertEqual(out, ("unknown:\n" " test.txt\n"))
392
392
out = self.run_bzr("stat")[0]
393
self.assertEquals(out, ("unknown:\n" " test.txt\n"))
393
self.assertEqual(out, ("unknown:\n" " test.txt\n"))
395
395
progress("command help")
396
396
self.run_bzr("help st")
422
422
self.run_bzr('log -v --forward')
423
423
self.run_bzr('log -m', retcode=3)
424
424
log_out = self.run_bzr('log -m commit')[0]
425
self.assert_("this is my new commit\n and" in log_out)
426
self.assert_("rename nested" not in log_out)
427
self.assert_('revision-id' not in log_out)
428
self.assert_('revision-id' in self.run_bzr('log --show-ids -m commit')[0])
425
self.assertTrue("this is my new commit\n and" in log_out)
426
self.assertTrue("rename nested" not in log_out)
427
self.assertTrue('revision-id' not in log_out)
428
self.assertTrue('revision-id' in self.run_bzr('log --show-ids -m commit')[0])
430
430
log_out = self.run_bzr('log --line')[0]
431
431
# determine the widest line we want
432
432
max_width = osutils.terminal_width()
433
433
if max_width is not None:
434
434
for line in log_out.splitlines():
435
self.assert_(len(line) <= max_width - 1, len(line))
436
self.assert_("this is my new commit and" not in log_out)
437
self.assert_("this is my new commit" in log_out)
435
self.assertTrue(len(line) <= max_width - 1, len(line))
436
self.assertTrue("this is my new commit and" not in log_out)
437
self.assertTrue("this is my new commit" in log_out)
439
439
progress("file with spaces in name")
440
440
mkdir('sub directory')
456
456
self.run_bzr('init')
457
457
os.symlink("NOWHERE1", "link1")
458
458
self.run_bzr('add link1')
459
self.assertEquals(self.run_bzr('unknowns')[0], '')
459
self.assertEqual(self.run_bzr('unknowns')[0], '')
460
460
self.run_bzr(['commit', '-m', '1: added symlink link1'])
463
463
self.run_bzr('add d1')
464
self.assertEquals(self.run_bzr('unknowns')[0], '')
464
self.assertEqual(self.run_bzr('unknowns')[0], '')
465
465
os.symlink("NOWHERE2", "d1/link2")
466
self.assertEquals(self.run_bzr('unknowns')[0], 'd1/link2\n')
466
self.assertEqual(self.run_bzr('unknowns')[0], 'd1/link2\n')
467
467
# is d1/link2 found when adding d1
468
468
self.run_bzr('add d1')
469
self.assertEquals(self.run_bzr('unknowns')[0], '')
469
self.assertEqual(self.run_bzr('unknowns')[0], '')
470
470
os.symlink("NOWHERE3", "d1/link3")
471
self.assertEquals(self.run_bzr('unknowns')[0], 'd1/link3\n')
471
self.assertEqual(self.run_bzr('unknowns')[0], 'd1/link3\n')
472
472
self.run_bzr(['commit', '-m', '2: added dir, symlink'])
474
474
self.run_bzr('rename d1 d2')
475
475
self.run_bzr('move d2/link2 .')
476
476
self.run_bzr('move link1 d2')
477
self.assertEquals(os.readlink("./link2"), "NOWHERE2")
478
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
477
self.assertEqual(os.readlink("./link2"), "NOWHERE2")
478
self.assertEqual(os.readlink("d2/link1"), "NOWHERE1")
479
479
self.run_bzr('add d2/link3')
480
480
self.run_bzr('diff', retcode=1)
481
481
self.run_bzr(['commit', '-m',
486
486
os.unlink("d2/link1")
487
487
os.symlink("TARGET 1", "d2/link1")
488
488
self.run_bzr('diff', retcode=1)
489
self.assertEquals(self.run_bzr("relpath d2/link1")[0], "d2/link1\n")
489
self.assertEqual(self.run_bzr("relpath d2/link1")[0], "d2/link1\n")
490
490
self.run_bzr(['commit', '-m', '4: retarget of two links'])
492
492
self.run_bzr('remove --keep d2/link1')
493
self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
493
self.assertEqual(self.run_bzr('unknowns')[0], 'd2/link1\n')
494
494
self.run_bzr(['commit', '-m', '5: remove d2/link1'])
495
495
# try with the rm alias
496
496
self.run_bzr('add d2/link1')
497
497
self.run_bzr(['commit', '-m', '6: add d2/link1'])
498
498
self.run_bzr('rm --keep d2/link1')
499
self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
499
self.assertEqual(self.run_bzr('unknowns')[0], 'd2/link1\n')
500
500
self.run_bzr(['commit', '-m', '7: remove d2/link1'])
503
503
self.run_bzr('add d1')
504
504
self.run_bzr('rename d2/link3 d1/link3new')
505
self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
505
self.assertEqual(self.run_bzr('unknowns')[0], 'd2/link1\n')
506
506
self.run_bzr(['commit', '-m',
507
507
'8: remove d2/link1, move/rename link3'])
511
511
self.run_bzr('export -r 1 exp1.tmp')
512
512
chdir("exp1.tmp")
513
self.assertEquals(listdir_sorted("."), [ "link1" ])
514
self.assertEquals(os.readlink("link1"), "NOWHERE1")
513
self.assertEqual(listdir_sorted("."), [ "link1" ])
514
self.assertEqual(os.readlink("link1"), "NOWHERE1")
517
517
self.run_bzr('export -r 2 exp2.tmp')
518
518
chdir("exp2.tmp")
519
self.assertEquals(listdir_sorted("."), [ "d1", "link1" ])
519
self.assertEqual(listdir_sorted("."), [ "d1", "link1" ])
522
522
self.run_bzr('export -r 3 exp3.tmp')
523
523
chdir("exp3.tmp")
524
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
525
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
526
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
527
self.assertEquals(os.readlink("link2") , "NOWHERE2")
524
self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
525
self.assertEqual(listdir_sorted("d2"), [ "link1", "link3" ])
526
self.assertEqual(os.readlink("d2/link1"), "NOWHERE1")
527
self.assertEqual(os.readlink("link2") , "NOWHERE2")
530
530
self.run_bzr('export -r 4 exp4.tmp')
531
531
chdir("exp4.tmp")
532
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
533
self.assertEquals(os.readlink("d2/link1"), "TARGET 1")
534
self.assertEquals(os.readlink("link2") , "TARGET 2")
535
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
532
self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
533
self.assertEqual(os.readlink("d2/link1"), "TARGET 1")
534
self.assertEqual(os.readlink("link2") , "TARGET 2")
535
self.assertEqual(listdir_sorted("d2"), [ "link1", "link3" ])
538
538
self.run_bzr('export -r 5 exp5.tmp')
539
539
chdir("exp5.tmp")
540
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
541
self.assert_(os.path.islink("link2"))
542
self.assert_(listdir_sorted("d2")== [ "link3" ])
540
self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
541
self.assertTrue(os.path.islink("link2"))
542
self.assertTrue(listdir_sorted("d2")== [ "link3" ])
545
545
self.run_bzr('export -r 8 exp6.tmp')
546
546
chdir("exp6.tmp")
547
547
self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"])
548
self.assertEquals(listdir_sorted("d1"), [ "link3new" ])
549
self.assertEquals(listdir_sorted("d2"), [])
550
self.assertEquals(os.readlink("d1/link3new"), "NOWHERE3")
548
self.assertEqual(listdir_sorted("d1"), [ "link3new" ])
549
self.assertEqual(listdir_sorted("d2"), [])
550
self.assertEqual(os.readlink("d1/link3new"), "NOWHERE3")
553
553
progress("skipping symlink tests")