~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Move working tree initialisation out from  Branch.initialize, deprecated Branch.initialize to Branch.create.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
48
48
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
49
49
from bzrlib.tests.blackbox import ExternalBase
 
50
from bzrlib.workingtree import WorkingTree
50
51
 
51
52
class TestCommands(ExternalBase):
52
53
 
164
165
        self.runbzr('commit -m newstuff branch', retcode=3)
165
166
 
166
167
    def test_ignore_patterns(self):
167
 
        from bzrlib.branch import Branch
168
 
        Branch.initialize('.')
 
168
        self.runbzr('init')
169
169
        self.assertEquals(self.capture('unknowns'), '')
170
170
 
171
171
        file('foo.tmp', 'wt').write('tmp files are ignored')
259
259
 
260
260
    def test_mv_modes(self):
261
261
        """Test two modes of operation for mv"""
262
 
        from bzrlib.branch import Branch
263
 
        b = Branch.initialize('.')
 
262
        self.runbzr('init')
264
263
        self.build_tree(['a', 'c', 'subdir/'])
265
264
        self.run_bzr_captured(['add', self.test_dir])
266
265
        self.run_bzr_captured(['mv', 'a', 'b'])
626
625
        
627
626
    def test_add_reports(self):
628
627
        """add command prints the names of added files."""
629
 
        b = Branch.initialize('.')
 
628
        self.runbzr('init')
630
629
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
631
630
        out = self.run_bzr_captured(['add'], retcode=0)[0]
632
631
        # the ordering is not defined at the moment
647
646
 
648
647
    def test_add_quiet_is(self):
649
648
        """add -q does not print the names of added files."""
650
 
        b = Branch.initialize('.')
 
649
        self.runbzr('init')
651
650
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
652
651
        out = self.run_bzr_captured(['add', '-q'], retcode=0)[0]
653
652
        # the ordering is not defined at the moment
659
658
 
660
659
        "bzr add" should add the parent(s) as necessary.
661
660
        """
662
 
        from bzrlib.branch import Branch
663
 
        Branch.initialize('.')
 
661
        self.runbzr('init')
664
662
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
665
663
        self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
666
664
        self.run_bzr('add', 'inertiatic/esp')
683
681
 
684
682
        "bzr add" should do this happily.
685
683
        """
686
 
        from bzrlib.branch import Branch
687
 
        Branch.initialize('.')
 
684
        self.runbzr('init')
688
685
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
689
686
        self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
690
687
        self.run_bzr('add', '--no-recurse', 'inertiatic')
694
691
 
695
692
    def test_subdir_add(self):
696
693
        """Add in subdirectory should add only things from there down"""
697
 
        from bzrlib.branch import Branch
 
694
        from bzrlib.workingtree import WorkingTree
698
695
        
699
696
        eq = self.assertEqual
700
697
        ass = self.assert_
701
698
        chdir = os.chdir
702
699
        
703
 
        b = Branch.initialize('.')
704
 
        t = b.working_tree()
 
700
        t = WorkingTree.create_standalone('.')
 
701
        b = t.branch
705
702
        self.build_tree(['src/', 'README'])
706
703
        
707
704
        eq(sorted(t.unknowns()),
815
812
        """Test re signing of data."""
816
813
        import bzrlib.gpg
817
814
        oldstrategy = bzrlib.gpg.GPGStrategy
818
 
        branch = Branch.initialize('.')
819
 
        branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
 
815
        wt = WorkingTree.create_standalone('.')
 
816
        branch = wt.branch
 
817
        wt.commit("base", allow_pointless=True, rev_id='A')
820
818
        try:
821
819
            # monkey patch gpg signing mechanism
822
820
            from bzrlib.testament import Testament
830
828
    def test_resign_range(self):
831
829
        import bzrlib.gpg
832
830
        oldstrategy = bzrlib.gpg.GPGStrategy
833
 
        branch = Branch.initialize('.')
834
 
        branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
835
 
        branch.working_tree().commit("base", allow_pointless=True, rev_id='B')
836
 
        branch.working_tree().commit("base", allow_pointless=True, rev_id='C')
 
831
        wt = WorkingTree.create_standalone('.')
 
832
        branch = wt.branch
 
833
        wt.commit("base", allow_pointless=True, rev_id='A')
 
834
        wt.commit("base", allow_pointless=True, rev_id='B')
 
835
        wt.commit("base", allow_pointless=True, rev_id='C')
837
836
        try:
838
837
            # monkey patch gpg signing mechanism
839
838
            from bzrlib.testament import Testament
1228
1227
 
1229
1228
    def test_branch(self):
1230
1229
        os.mkdir('from')
1231
 
        branch = Branch.initialize('from')
1232
 
        branch.working_tree().commit('empty commit for nonsense', allow_pointless=True)
 
1230
        wt = WorkingTree.create_standalone('from')
 
1231
        branch = wt.branch
 
1232
        wt.commit('empty commit for nonsense', allow_pointless=True)
1233
1233
        url = self.get_remote_url('from')
1234
1234
        self.run_bzr('branch', url, 'to')
1235
1235
        branch = Branch.open('to')
1237
1237
 
1238
1238
    def test_log(self):
1239
1239
        self.build_tree(['branch/', 'branch/file'])
1240
 
        branch = Branch.initialize('branch')
1241
 
        branch.working_tree().add(['file'])
1242
 
        branch.working_tree().commit('add file', rev_id='A')
 
1240
        self.capture('init branch')
 
1241
        self.capture('add branch/file')
 
1242
        self.capture('commit -m foo branch')
1243
1243
        url = self.get_remote_url('branch/file')
1244
1244
        output = self.capture('log %s' % url)
1245
1245
        self.assertEqual(8, len(output.split('\n')))
1246
1246
        
1247
1247
    def test_check(self):
1248
1248
        self.build_tree(['branch/', 'branch/file'])
1249
 
        branch = Branch.initialize('branch')
1250
 
        branch.working_tree().add(['file'])
1251
 
        branch.working_tree().commit('add file', rev_id='A')
 
1249
        self.capture('init branch')
 
1250
        self.capture('add branch/file')
 
1251
        self.capture('commit -m foo branch')
1252
1252
        url = self.get_remote_url('branch/')
1253
1253
        self.run_bzr('check', url)
1254
1254