/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
821
821
        self.assertEqual(os.path.realpath('topdir/foo'),
822
822
                         self.local_branch_path(branch))
823
823
 
824
 
    def test_open_tree_or_branch_named(self):
825
 
        tree = self.make_branch_and_tree('topdir')
826
 
        self.assertRaises(
827
 
            NotBranchError,
828
 
            bzrdir.BzrDir.open_tree_or_branch, 'topdir', name='missing')
829
 
        tree.branch.controldir.create_branch('named')
830
 
        tree, branch = bzrdir.BzrDir.open_tree_or_branch('topdir', name='named')
831
 
        self.assertEqual(os.path.realpath('topdir'),
832
 
                         os.path.realpath(tree.basedir))
833
 
        self.assertEqual(os.path.realpath('topdir'),
834
 
                         self.local_branch_path(branch))
835
 
        self.assertEqual(branch.name, 'named')
836
 
        self.assertIs(tree.controldir, branch.controldir)
837
 
 
838
824
    def test_open_from_transport(self):
839
825
        # transport pointing at bzrdir should give a bzrdir with root transport
840
826
        # set to the given transport
856
842
        self.assertRaises(NotBranchError, bzrdir.BzrDir.open_from_transport, t)
857
843
 
858
844
    def test_sprout_recursive(self):
859
 
        tree = self.make_branch_and_tree('tree1')
860
 
        sub_tree = self.make_branch_and_tree('tree1/subtree')
 
845
        tree = self.make_branch_and_tree('tree1',
 
846
                                         format='development-subtree')
 
847
        sub_tree = self.make_branch_and_tree('tree1/subtree',
 
848
                                             format='development-subtree')
861
849
        sub_tree.set_root_id(b'subtree-root')
862
850
        tree.add_reference(sub_tree)
863
 
        tree.set_reference_info('subtree', sub_tree.branch.user_url)
864
851
        self.build_tree(['tree1/subtree/file'])
865
852
        sub_tree.add('file')
866
853
        tree.commit('Initial commit')
885
872
        sub_tree = self.make_branch_and_tree('tree1/subtree',
886
873
                                             format='development-subtree')
887
874
        tree.add_reference(sub_tree)
888
 
        tree.set_reference_info('subtree', sub_tree.branch.user_url)
889
875
        self.build_tree(['tree1/subtree/file'])
890
876
        sub_tree.add('file')
891
877
        tree.commit('Initial commit')
892
878
        # The following line force the orhaning to reveal bug #634470
893
 
        tree.branch.get_config_stack().set('transform.orphan_policy', 'move')
 
879
        tree.branch.get_config_stack().set(
 
880
            'transform.orphan_policy', 'move')
894
881
        tree.controldir.destroy_workingtree()
895
882
        # FIXME: subtree/.bzr is left here which allows the test to pass (or
896
883
        # fail :-( ) -- vila 20100909
905
892
        # by bzrdir.BzrDirMeta1.destroy_workingtree when it ignores the
906
893
        # [DeletingParent('Not deleting', u'subtree', None)] conflict). See bug
907
894
        # #634470.  -- vila 20100909
908
 
        tree.controldir.sprout('repo/tree2')
909
 
        self.assertPathExists('repo/tree2/subtree')
910
 
        self.assertPathDoesNotExist('repo/tree2/subtree/file')
 
895
        self.assertRaises(errors.NotBranchError,
 
896
                          tree.controldir.sprout, 'repo/tree2')
 
897
#        self.assertPathExists('repo/tree2/subtree')
 
898
#        self.assertPathDoesNotExist('repo/tree2/subtree/file')
911
899
 
912
900
    def make_foo_bar_baz(self):
913
901
        foo = bzrdir.BzrDir.create_branch_convenience('foo').controldir
1252
1240
        return out.splitlines()
1253
1241
 
1254
1242
    def test_dot_bzr_hidden(self):
 
1243
        if sys.platform == 'win32' and not win32utils.has_win32file:
 
1244
            raise TestSkipped(
 
1245
                'unable to make file hidden without pywin32 library')
1255
1246
        b = bzrdir.BzrDir.create('.')
1256
1247
        self.build_tree(['a'])
1257
1248
        self.assertEqual([b'a'], self.get_ls())
1258
1249
 
1259
1250
    def test_dot_bzr_hidden_with_url(self):
 
1251
        if sys.platform == 'win32' and not win32utils.has_win32file:
 
1252
            raise TestSkipped(
 
1253
                'unable to make file hidden without pywin32 library')
1260
1254
        b = bzrdir.BzrDir.create(urlutils.local_path_to_url('.'))
1261
1255
        self.build_tree(['a'])
1262
1256
        self.assertEqual([b'a'], self.get_ls())