~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Robert Collins
  • Date: 2005-10-30 00:00:09 UTC
  • mfrom: (1185.16.134)
  • Revision ID: robertc@robertcollins.net-20051030000009-9db99a338a0dfdac
MergeĀ fromĀ Martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
356
356
        self.runbzr('revert --no-backup')
357
357
        self.runbzr('merge ../b -r last:1..last:1 --merge-type weave')
358
358
        self.runbzr('revert --no-backup')
 
359
        self.runbzr('merge ../b -r last:1..last:1 --reprocess')
 
360
        self.runbzr('revert --no-backup')
359
361
        self.runbzr('merge ../b -r last:1')
360
362
        self.check_file_contents('goodbye', 'quux')
361
363
        # Merging a branch pulls its revision into the tree
460
462
        self.runbzr('pull ../b')
461
463
        self.runbzr('pull ../b')
462
464
 
 
465
    def test_ls(self):
 
466
        """Test the abilities of 'bzr ls'"""
 
467
        bzr = self.runbzr
 
468
        def bzrout(*args, **kwargs):
 
469
            kwargs['backtick'] = True
 
470
            return self.runbzr(*args, **kwargs)
 
471
 
 
472
        def ls_equals(value, *args):
 
473
            out = self.runbzr(['ls'] + list(args), backtick=True)
 
474
            self.assertEquals(out, value)
 
475
 
 
476
        bzr('init')
 
477
        open('a', 'wb').write('hello\n')
 
478
 
 
479
        # Can't supply both
 
480
        bzr('ls --verbose --null', retcode=1)
 
481
 
 
482
        ls_equals('a\n')
 
483
        ls_equals('?        a\n', '--verbose')
 
484
        ls_equals('a\n', '--unknown')
 
485
        ls_equals('', '--ignored')
 
486
        ls_equals('', '--versioned')
 
487
        ls_equals('a\n', '--unknown', '--ignored', '--versioned')
 
488
        ls_equals('', '--ignored', '--versioned')
 
489
        ls_equals('a\0', '--null')
 
490
 
 
491
        bzr('add a')
 
492
        ls_equals('V        a\n', '--verbose')
 
493
        bzr('commit -m add')
 
494
        
 
495
        os.mkdir('subdir')
 
496
        ls_equals('V        a\n'
 
497
                  '?        subdir/\n'
 
498
                  , '--verbose')
 
499
        open('subdir/b', 'wb').write('b\n')
 
500
        bzr('add')
 
501
        ls_equals('V        a\n'
 
502
                  'V        subdir/\n'
 
503
                  'V        subdir/b\n'
 
504
                  , '--verbose')
 
505
        bzr('commit -m subdir')
 
506
 
 
507
        ls_equals('a\n'
 
508
                  'subdir\n'
 
509
                  , '--non-recursive')
 
510
 
 
511
        ls_equals('V        a\n'
 
512
                  'V        subdir/\n'
 
513
                  , '--verbose', '--non-recursive')
 
514
 
 
515
        # Check what happens in a sub-directory
 
516
        os.chdir('subdir')
 
517
        ls_equals('b\n')
 
518
        ls_equals('b\0'
 
519
                  , '--null')
 
520
        ls_equals('a\n'
 
521
                  'subdir\n'
 
522
                  'subdir/b\n'
 
523
                  , '--from-root')
 
524
        ls_equals('a\0'
 
525
                  'subdir\0'
 
526
                  'subdir/b\0'
 
527
                  , '--from-root', '--null')
 
528
        ls_equals('a\n'
 
529
                  'subdir\n'
 
530
                  , '--from-root', '--non-recursive')
 
531
 
 
532
        os.chdir('..')
 
533
 
 
534
        # Check what happens when we supply a specific revision
 
535
        ls_equals('a\n', '--revision', '1')
 
536
        ls_equals('V        a\n'
 
537
                  , '--verbose', '--revision', '1')
 
538
 
 
539
        os.chdir('subdir')
 
540
        ls_equals('', '--revision', '1')
 
541
 
 
542
        # Now try to do ignored files.
 
543
        os.chdir('..')
 
544
        open('blah.py', 'wb').write('unknown\n')
 
545
        open('blah.pyo', 'wb').write('ignored\n')
 
546
        ls_equals('a\n'
 
547
                  'blah.py\n'
 
548
                  'blah.pyo\n'
 
549
                  'subdir\n'
 
550
                  'subdir/b\n')
 
551
        ls_equals('V        a\n'
 
552
                  '?        blah.py\n'
 
553
                  'I        blah.pyo\n'
 
554
                  'V        subdir/\n'
 
555
                  'V        subdir/b\n'
 
556
                  , '--verbose')
 
557
        ls_equals('blah.pyo\n'
 
558
                  , '--ignored')
 
559
        ls_equals('blah.py\n'
 
560
                  , '--unknown')
 
561
        ls_equals('a\n'
 
562
                  'subdir\n'
 
563
                  'subdir/b\n'
 
564
                  , '--versioned')
 
565
 
 
566
 
463
567
    def test_locations(self):
464
568
        """Using and remembering different locations"""
465
569
        os.mkdir('a')