~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-15 11:38:29 UTC
  • mfrom: (1185.16.40)
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051015113829-40226233fb246920
mergeĀ fromĀ martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from cStringIO import StringIO
28
28
import os
29
 
import re
30
29
import shutil
31
30
import sys
 
31
import os
32
32
 
33
33
from bzrlib.branch import Branch
34
34
from bzrlib.clone import copy_branch
400
400
        self.runbzr('commit -m blah2 --unchanged')
401
401
        os.chdir('../b')
402
402
        self.runbzr('commit -m blah3 --unchanged')
403
 
        # no clobber
404
403
        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())
 
404
        print "DECIDE IF PULL CAN CONVERGE, blackbox.py"
 
405
        return
412
406
        os.chdir('../a')
413
407
        self.runbzr('merge ../b')
414
408
        self.runbzr('commit -m blah4 --unchanged')
517
511
        self.runbzr('commit -m conflicts')
518
512
        self.assertEquals(result, "")
519
513
 
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
514
def listdir_sorted(dir):
537
515
    L = os.listdir(dir)
538
516
    L.sort()
636
614
        runbzr("add sub1")
637
615
        runbzr("rename sub1 sub2")
638
616
        runbzr("move hello.txt sub2")
639
 
        self.assertEqual(capture("relpath sub2/hello.txt"),
640
 
                         os.path.join("sub2", "hello.txt\n"))
 
617
        assert capture("relpath sub2/hello.txt") == os.path.join("sub2", "hello.txt\n")
641
618
 
642
619
        assert exists("sub2")
643
620
        assert exists("sub2/hello.txt")
677
654
        f.close()
678
655
 
679
656
        f = file('msg.tmp', 'wt')
680
 
        f.write('this is my new commit\nand it has multiple lines, for fun')
 
657
        f.write('this is my new commit\n')
681
658
        f.close()
682
659
 
683
660
        runbzr('commit -F msg.tmp')
691
668
        runbzr('log -v --forward')
692
669
        runbzr('log -m', retcode=1)
693
670
        log_out = capture('log -m commit')
694
 
        assert "this is my new commit\n  and" in log_out
 
671
        assert "this is my new commit" in log_out
695
672
        assert "rename nested" not in log_out
696
673
        assert 'revision-id' not in log_out
697
674
        assert 'revision-id' in capture('log --show-ids -m commit')
698
675
 
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
676
 
705
677
        progress("file with spaces in name")
706
678
        mkdir('sub directory')
828
800
        self.run_bzr('branch', url, 'to')
829
801
        branch = Branch.open('to')
830
802
        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