def test_not_branch_path(self): tree = self.make_svn_branch_and_tree('a', 'dc') self.build_tree({"dc/file": b"data"}) self.client_add("dc/file") self.client_commit("dc", "initial") self.client_update("dc") self.build_tree({"dc/dir": None}) self.client_add("dc/dir") config_set_scheme(Repository.open(tree.branch.repository.base), TrunkBranchingScheme(0), None, True) Repository.open(tree.branch.repository.base).store_layout(TrunkLayout(0)) self.assertRaises(NotBranchError, WorkingTree.open, "dc/foobar") self.assertRaises(NotBranchError, WorkingTree.open, "dc/dir") WorkingTree.open("dc")
def test_unprefix_nested_branch_sub(self): self.assertEqual(TrunkBranchingScheme().unprefix(u"branches/ver1/foo"), ("", "branches/ver1", "foo"))
def test_v3(self): revprops = self._generate_revprops(BzrSvnMappingv3(TrunkBranchingScheme())) self.assertEquals(self.testament.as_short_text(), revprops[mapping.SVN_REVPROP_BZR_TESTAMENT])
def test_get_scheme_mandatory_set(self): c = self.config c.set_branching_scheme(TrunkBranchingScheme(), None, mandatory=True) self.assertEquals(True, c.branching_scheme_is_mandatory()) c.set_branching_scheme(TrunkBranchingScheme(), None, mandatory=False) self.assertEquals(False, c.branching_scheme_is_mandatory())
def test_get_branch_path_nonzero(self): self.assertEquals( "my/project/branches/foo", TrunkBranchingScheme(2).get_branch_path(u"foo", u"my/project"))
def test_get_branch_path_zero(self): self.assertEquals("branches/foo", TrunkBranchingScheme().get_branch_path(u"foo"))
def test_is_tag_parent_level_tags(self): self.assertTrue( TrunkBranchingScheme(1).is_tag_parent(u"anything/tags"))
def test_is_branch_parent_level_inside(self): self.assertFalse( TrunkBranchingScheme(1).is_branch_parent(u"foo/trunk/foo"))
def test_unprefix_level_correct_nested(self): self.assertEqual( TrunkBranchingScheme(1).unprefix(u"data/tags/ver1"), ("data", "data/tags/ver1", ""))
def test_unprefix_level_correct_branch(self): self.assertEqual( TrunkBranchingScheme(1).unprefix(u"/foo/trunk"), ("foo", "foo/trunk", ""))
def test_unprefix_level_wrong_level_nested(self): self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, u"branches/ver1/foo")
def test_unprefix_level(self): self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, u"trunk")
def test_unprefix_slash_tag(self): self.assertEqual( TrunkBranchingScheme().unprefix(u"/tags/ver2/foo/bar"), ("", "tags/ver2", "foo/bar"))
def test_unprefix_doubleslash_branch(self): self.assertEqual(TrunkBranchingScheme().unprefix(u"//trunk/foo"), ("", "trunk", "foo"))
def test_unprefix_nested_tag_sub(self): self.assertEqual(TrunkBranchingScheme().unprefix(u"tags/ver1"), ("", "tags/ver1", ""))
def test_is_tag_parent_level(self): self.assertFalse(TrunkBranchingScheme(1).is_tag_parent(u"anything"))
def test_is_branch_parent_level_root(self): self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(u""))
def test_str0(self): self.assertEqual("trunk0", TrunkBranchingScheme().__str__())
def test_is_branch_parent_level_branches(self): self.assertTrue( TrunkBranchingScheme(1).is_branch_parent(u"anything/branches"))
def test_str1(self): self.assertEqual("trunk1", TrunkBranchingScheme(1).__str__())
def test_is_branch_parent_other(self): self.assertFalse(TrunkBranchingScheme().is_branch_parent(u"trunk/foo"))
def test_is_tag_parent_root(self): self.assertFalse(TrunkBranchingScheme().is_tag_parent(u""))
def test_get_branch_path_zero_trunk(self): self.assertEquals("trunk", TrunkBranchingScheme().get_branch_path(u"trunk"))
def test_is_branch_parent_branches(self): self.assertTrue(TrunkBranchingScheme().is_branch_parent(u"branches"))
def test_get_scheme_set(self): c = self.config c.set_branching_scheme(TrunkBranchingScheme(), None) self.assertEquals("trunk0", str(c.get_branching_scheme()))
def test_is_tagparent_branches(self): self.assertFalse(TrunkBranchingScheme().is_tag_parent(u"branches"))
def test_is_tagparent_tags(self): self.assertTrue(TrunkBranchingScheme().is_tag_parent(u"tags"))
def test_is_branch_parent_trunk(self): self.assertFalse(TrunkBranchingScheme().is_branch_parent(u"trunk"))
def test_v3_undefined(self): self.assertEqual((("uuid", "trunk", 1), BzrSvnMappingv3(TrunkBranchingScheme())), mapping_registry.parse_revision_id("svn-v3-undefined:uuid:trunk:1"))
def test_unprefix_slash_branch(self): self.assertEqual(TrunkBranchingScheme().unprefix(u"/trunk"), ("", "trunk", ""))