~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

- refactor handling of short option names

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
        self.log(tmp_output)
219
219
        self.assertEquals(output, tmp_output)
220
220
 
 
221
    def test_option_help(self):
 
222
        """Options have help strings"""
 
223
        out, err = self.run_bzr_captured(['commit', '--help'])
 
224
        self.assertContainsRe(out, r'--file.*file containing commit message')
 
225
 
221
226
    def example_branch(test):
222
227
        test.runbzr('init')
223
228
        file('hello', 'wt').write('foo')
400
405
        self.runbzr('commit -m blah2 --unchanged')
401
406
        os.chdir('../b')
402
407
        self.runbzr('commit -m blah3 --unchanged')
403
 
        # no clobber
404
408
        self.runbzr('pull ../a', retcode=1)
405
 
        os.chdir('..')
406
 
        self.runbzr('branch b clobberme')
407
 
        os.chdir('clobberme')
408
 
        self.runbzr('pull --clobber ../a')
409
 
        clobbered = Branch.open('.')
410
 
        self.assertEqual(clobbered.revision_history(),
411
 
                         a.revision_history())
 
409
        print "DECIDE IF PULL CAN CONVERGE, blackbox.py"
 
410
        return
412
411
        os.chdir('../a')
413
412
        self.runbzr('merge ../b')
414
413
        self.runbzr('commit -m blah4 --unchanged')
517
516
        self.runbzr('commit -m conflicts')
518
517
        self.assertEquals(result, "")
519
518
 
520
 
    def test_resign(self):
521
 
        """Test re signing of data."""
522
 
        import bzrlib.gpg
523
 
        oldstrategy = bzrlib.gpg.GPGStrategy
524
 
        branch = Branch.initialize('.')
525
 
        branch.commit("base", allow_pointless=True, rev_id='A')
526
 
        try:
527
 
            # monkey patch gpg signing mechanism
528
 
            from bzrlib.testament import Testament
529
 
            bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
530
 
            self.runbzr('re-sign -r revid:A')
531
 
            self.assertEqual(Testament.from_revision(branch,'A').as_short_text(),
532
 
                             branch.revision_store.get('A', 'sig').read())
533
 
        finally:
534
 
            bzrlib.gpg.GPGStrategy = oldstrategy
535
 
 
536
519
def listdir_sorted(dir):
537
520
    L = os.listdir(dir)
538
521
    L.sort()
636
619
        runbzr("add sub1")
637
620
        runbzr("rename sub1 sub2")
638
621
        runbzr("move hello.txt sub2")
639
 
        self.assertEqual(capture("relpath sub2/hello.txt"),
640
 
                         os.path.join("sub2", "hello.txt\n"))
 
622
        assert capture("relpath sub2/hello.txt") == os.path.join("sub2", "hello.txt\n")
641
623
 
642
624
        assert exists("sub2")
643
625
        assert exists("sub2/hello.txt")
677
659
        f.close()
678
660
 
679
661
        f = file('msg.tmp', 'wt')
680
 
        f.write('this is my new commit\nand it has multiple lines, for fun')
 
662
        f.write('this is my new commit\n')
681
663
        f.close()
682
664
 
683
665
        runbzr('commit -F msg.tmp')
691
673
        runbzr('log -v --forward')
692
674
        runbzr('log -m', retcode=1)
693
675
        log_out = capture('log -m commit')
694
 
        assert "this is my new commit\n  and" in log_out
 
676
        assert "this is my new commit" in log_out
695
677
        assert "rename nested" not in log_out
696
678
        assert 'revision-id' not in log_out
697
679
        assert 'revision-id' in capture('log --show-ids -m commit')
698
680
 
699
 
        log_out = capture('log --line')
700
 
        for line in log_out.splitlines():
701
 
            assert len(line) <= 79, len(line)
702
 
        assert "this is my new commit and" in log_out
703
 
 
704
681
 
705
682
        progress("file with spaces in name")
706
683
        mkdir('sub directory')
828
805
        self.run_bzr('branch', url, 'to')
829
806
        branch = Branch.open('to')
830
807
        self.assertEqual(1, len(branch.revision_history()))
831
 
 
832
 
    def test_log(self):
833
 
        self.build_tree(['branch/', 'branch/file'])
834
 
        branch = Branch.initialize('branch')
835
 
        branch.add(['file'])
836
 
        branch.commit('add file', rev_id='A')
837
 
        url = self.get_remote_url('branch/file')
838
 
        output = self.capture('log %s' % url)
839
 
        self.assertEqual(7, len(output.split('\n')))
840
 
        
841
 
 
842
 
 
843