~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_too_much.py

  • Committer: Martin Pool
  • Date: 2007-06-26 10:12:33 UTC
  • mto: This revision was merged to the branch mainline in revision 2555.
  • Revision ID: mbp@sourcefrog.net-20070626101233-hrmvl09320gt6b8m
Deprecate run_bzr_captured in favour of just  run_bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        """Check output from version command and master option is reasonable"""
117
117
        # output is intentionally passed through to stdout so that we
118
118
        # can see the version being tested
119
 
        output = self.run_bzr_captured(['version'])[0]
 
119
        output = self.run_bzr(['version'])[0]
120
120
        self.log('bzr version output:')
121
121
        self.log(output)
122
122
        self.assert_(output.startswith('Bazaar (bzr) '))
123
123
        self.assertNotEqual(output.index('Canonical'), -1)
124
124
        # make sure --version is consistent
125
 
        tmp_output = self.run_bzr_captured(['--version'])[0]
 
125
        tmp_output = self.run_bzr(['--version'])[0]
126
126
        self.assertEquals(output, tmp_output)
127
127
 
128
128
    def example_branch(test):
147
147
        os.chdir('b')
148
148
        open('b', 'wb').write('else\n')
149
149
        self.run_bzr('add b')
150
 
        self.run_bzr_captured(['commit', '-m', 'added b'])
 
150
        self.run_bzr(['commit', '-m', 'added b'])
151
151
 
152
152
        os.chdir('../a')
153
153
        out = self.run_bzr('pull --verbose ../b')[0]
205
205
        
206
206
    def test_unknown_command(self):
207
207
        """Handling of unknown command."""
208
 
        out, err = self.run_bzr_captured(['fluffy-badger'],
 
208
        out, err = self.run_bzr(['fluffy-badger'],
209
209
                                         retcode=3)
210
210
        self.assertEquals(out, '')
211
211
        err.index('unknown command')
245
245
        self.run_bzr('commit --unchanged --message pumpkin')
246
246
        os.chdir('../branch3')
247
247
        self.run_bzr('merge ../branch2')
248
 
        message = self.run_bzr_captured('status')[0]
 
248
        message = self.run_bzr('status')[0]
249
249
 
250
250
 
251
251
    def test_conflicts(self):
387
387
        chdir('branch1')
388
388
        self.run_bzr('init')
389
389
 
390
 
        self.assertEquals(self.run_bzr_captured('root')[0].rstrip(),
 
390
        self.assertEquals(self.run_bzr('root')[0].rstrip(),
391
391
                          pathjoin(self.test_dir, 'branch1'))
392
392
 
393
393
        progress("status of new file")
396
396
        f.write('hello world!\n')
397
397
        f.close()
398
398
 
399
 
        self.assertEquals(self.run_bzr_captured('unknowns')[0], 'test.txt\n')
 
399
        self.assertEquals(self.run_bzr('unknowns')[0], 'test.txt\n')
400
400
 
401
 
        out = self.run_bzr_captured("status")[0]
 
401
        out = self.run_bzr("status")[0]
402
402
        self.assertEquals(out, 'unknown:\n  test.txt\n')
403
403
 
404
404
        f = file('test2.txt', 'wt')
405
405
        f.write('goodbye cruel world...\n')
406
406
        f.close()
407
407
 
408
 
        out = self.run_bzr_captured("status test.txt")[0]
 
408
        out = self.run_bzr("status test.txt")[0]
409
409
        self.assertEquals(out, "unknown:\n  test.txt\n")
410
410
 
411
 
        out = self.run_bzr_captured("status")[0]
 
411
        out = self.run_bzr("status")[0]
412
412
        self.assertEquals(out, ("unknown:\n" "  test.txt\n" "  test2.txt\n"))
413
413
 
414
414
        os.unlink('test2.txt')
415
415
 
416
416
        progress("command aliases")
417
 
        out = self.run_bzr_captured("st")[0]
 
417
        out = self.run_bzr("st")[0]
418
418
        self.assertEquals(out, ("unknown:\n" "  test.txt\n"))
419
419
 
420
 
        out = self.run_bzr_captured("stat")[0]
 
420
        out = self.run_bzr("stat")[0]
421
421
        self.assertEquals(out, ("unknown:\n" "  test.txt\n"))
422
422
 
423
423
        progress("command help")
426
426
        self.run_bzr("help commands")
427
427
        self.run_bzr("help slartibartfast", retcode=3)
428
428
 
429
 
        out = self.run_bzr_captured("help ci")[0]
 
429
        out = self.run_bzr("help ci")[0]
430
430
        out.index('aliases: ci, checkin\n')
431
431
 
432
432
        f = file('hello.txt', 'wt')
441
441
 
442
442
        self.run_bzr('commit -F msg.tmp')
443
443
 
444
 
        self.assertEquals(self.run_bzr_captured('revno')[0], '1\n')
 
444
        self.assertEquals(self.run_bzr('revno')[0], '1\n')
445
445
        self.run_bzr('export -r 1 export-1.tmp')
446
446
        self.run_bzr('export export.tmp')
447
447
 
449
449
        self.run_bzr('log -v')
450
450
        self.run_bzr('log -v --forward')
451
451
        self.run_bzr('log -m', retcode=3)
452
 
        log_out = self.run_bzr_captured('log -m commit')[0]
 
452
        log_out = self.run_bzr('log -m commit')[0]
453
453
        self.assert_("this is my new commit\n  and" in log_out)
454
454
        self.assert_("rename nested" not in log_out)
455
455
        self.assert_('revision-id' not in log_out)
456
 
        self.assert_('revision-id' in self.run_bzr_captured('log --show-ids -m commit')[0])
 
456
        self.assert_('revision-id' in self.run_bzr('log --show-ids -m commit')[0])
457
457
 
458
 
        log_out = self.run_bzr_captured('log --line')[0]
 
458
        log_out = self.run_bzr('log --line')[0]
459
459
        # determine the widest line we want
460
460
        max_width = terminal_width() - 1
461
461
        for line in log_out.splitlines():
483
483
            self.run_bzr('init')
484
484
            os.symlink("NOWHERE1", "link1")
485
485
            self.run_bzr('add link1')
486
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], '')
487
 
            self.run_bzr_captured(['commit', '-m', '1: added symlink link1'])
 
486
            self.assertEquals(self.run_bzr('unknowns')[0], '')
 
487
            self.run_bzr(['commit', '-m', '1: added symlink link1'])
488
488
    
489
489
            mkdir('d1')
490
490
            self.run_bzr('add d1')
491
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], '')
 
491
            self.assertEquals(self.run_bzr('unknowns')[0], '')
492
492
            os.symlink("NOWHERE2", "d1/link2")
493
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], 'd1/link2\n')
 
493
            self.assertEquals(self.run_bzr('unknowns')[0], 'd1/link2\n')
494
494
            # is d1/link2 found when adding d1
495
495
            self.run_bzr('add d1')
496
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], '')
 
496
            self.assertEquals(self.run_bzr('unknowns')[0], '')
497
497
            os.symlink("NOWHERE3", "d1/link3")
498
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], 'd1/link3\n')
499
 
            self.run_bzr_captured(['commit', '-m', '2: added dir, symlink'])
 
498
            self.assertEquals(self.run_bzr('unknowns')[0], 'd1/link3\n')
 
499
            self.run_bzr(['commit', '-m', '2: added dir, symlink'])
500
500
    
501
501
            self.run_bzr('rename d1 d2')
502
502
            self.run_bzr('move d2/link2 .')
505
505
            self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
506
506
            self.run_bzr('add d2/link3')
507
507
            self.run_bzr('diff', retcode=1)
508
 
            self.run_bzr_captured(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
 
508
            self.run_bzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
509
509
    
510
510
            os.unlink("link2")
511
511
            os.symlink("TARGET 2", "link2")
512
512
            os.unlink("d2/link1")
513
513
            os.symlink("TARGET 1", "d2/link1")
514
514
            self.run_bzr('diff', retcode=1)
515
 
            self.assertEquals(self.run_bzr_captured("relpath d2/link1")[0], "d2/link1\n")
516
 
            self.run_bzr_captured(['commit', '-m', '4: retarget of two links'])
 
515
            self.assertEquals(self.run_bzr("relpath d2/link1")[0], "d2/link1\n")
 
516
            self.run_bzr(['commit', '-m', '4: retarget of two links'])
517
517
    
518
518
            self.run_bzr('remove --keep d2/link1')
519
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], 'd2/link1\n')
520
 
            self.run_bzr_captured(['commit', '-m', '5: remove d2/link1'])
 
519
            self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
 
520
            self.run_bzr(['commit', '-m', '5: remove d2/link1'])
521
521
            # try with the rm alias
522
522
            self.run_bzr('add d2/link1')
523
 
            self.run_bzr_captured(['commit', '-m', '6: add d2/link1'])
 
523
            self.run_bzr(['commit', '-m', '6: add d2/link1'])
524
524
            self.run_bzr('rm --keep d2/link1')
525
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], 'd2/link1\n')
526
 
            self.run_bzr_captured(['commit', '-m', '7: remove d2/link1'])
 
525
            self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
 
526
            self.run_bzr(['commit', '-m', '7: remove d2/link1'])
527
527
    
528
528
            os.mkdir("d1")
529
529
            self.run_bzr('add d1')
530
530
            self.run_bzr('rename d2/link3 d1/link3new')
531
 
            self.assertEquals(self.run_bzr_captured('unknowns')[0], 'd2/link1\n')
532
 
            self.run_bzr_captured(['commit', '-m', '8: remove d2/link1, move/rename link3'])
533
 
            
534
 
            self.run_bzr_captured(['check'])
535
 
            
536
 
            self.run_bzr_captured(['export', '-r', '1', 'exp1.tmp'])
 
531
            self.assertEquals(self.run_bzr('unknowns')[0], 'd2/link1\n')
 
532
            self.run_bzr(['commit', '-m', '8: remove d2/link1, move/rename link3'])
 
533
            
 
534
            self.run_bzr(['check'])
 
535
            
 
536
            self.run_bzr(['export', '-r', '1', 'exp1.tmp'])
537
537
            chdir("exp1.tmp")
538
538
            self.assertEquals(listdir_sorted("."), [ "link1" ])
539
539
            self.assertEquals(os.readlink("link1"), "NOWHERE1")
540
540
            chdir("..")
541
541
            
542
 
            self.run_bzr_captured(['export', '-r', '2', 'exp2.tmp'])
 
542
            self.run_bzr(['export', '-r', '2', 'exp2.tmp'])
543
543
            chdir("exp2.tmp")
544
544
            self.assertEquals(listdir_sorted("."), [ "d1", "link1" ])
545
545
            chdir("..")
546
546
            
547
 
            self.run_bzr_captured(['export', '-r', '3', 'exp3.tmp'])
 
547
            self.run_bzr(['export', '-r', '3', 'exp3.tmp'])
548
548
            chdir("exp3.tmp")
549
549
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
550
550
            self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
552
552
            self.assertEquals(os.readlink("link2")   , "NOWHERE2")
553
553
            chdir("..")
554
554
            
555
 
            self.run_bzr_captured(['export', '-r', '4', 'exp4.tmp'])
 
555
            self.run_bzr(['export', '-r', '4', 'exp4.tmp'])
556
556
            chdir("exp4.tmp")
557
557
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
558
558
            self.assertEquals(os.readlink("d2/link1"), "TARGET 1")
560
560
            self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
561
561
            chdir("..")
562
562
            
563
 
            self.run_bzr_captured(['export', '-r', '5', 'exp5.tmp'])
 
563
            self.run_bzr(['export', '-r', '5', 'exp5.tmp'])
564
564
            chdir("exp5.tmp")
565
565
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
566
566
            self.assert_(os.path.islink("link2"))
567
567
            self.assert_(listdir_sorted("d2")== [ "link3" ])
568
568
            chdir("..")
569
569
            
570
 
            self.run_bzr_captured(['export', '-r', '8', 'exp6.tmp'])
 
570
            self.run_bzr(['export', '-r', '8', 'exp6.tmp'])
571
571
            chdir("exp6.tmp")
572
572
            self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"])
573
573
            self.assertEquals(listdir_sorted("d1"), [ "link3new" ])
595
595
 
596
596
    def test_log(self):
597
597
        self.build_tree(['branch/', 'branch/file'])
598
 
        self.run_bzr_captured('init branch')[0]
599
 
        self.run_bzr_captured('add branch/file')[0]
600
 
        self.run_bzr_captured('commit -m foo branch')[0]
 
598
        self.run_bzr('init branch')[0]
 
599
        self.run_bzr('add branch/file')[0]
 
600
        self.run_bzr('commit -m foo branch')[0]
601
601
        url = self.get_readonly_url('branch/file')
602
 
        output = self.run_bzr_captured('log %s' % url)[0]
 
602
        output = self.run_bzr('log %s' % url)[0]
603
603
        self.assertEqual(8, len(output.split('\n')))
604
604
        
605
605
    def test_check(self):
606
606
        self.build_tree(['branch/', 'branch/file'])
607
 
        self.run_bzr_captured('init branch')[0]
608
 
        self.run_bzr_captured('add branch/file')[0]
609
 
        self.run_bzr_captured('commit -m foo branch')[0]
 
607
        self.run_bzr('init branch')[0]
 
608
        self.run_bzr('add branch/file')[0]
 
609
        self.run_bzr('commit -m foo branch')[0]
610
610
        url = self.get_readonly_url('branch/')
611
611
        self.run_bzr('check', url)
612
612