Esempio n. 1
0
 def test_set_branching_scheme_property(self):
     self.make_checkout(self.repos_url, 'dc')
     self.client_set_prop("dc", SVN_PROP_BZR_BRANCHING_SCHEME, 
         "trunk\nbranches/*\nbranches/tmp/*")
     self.client_commit("dc", "set scheme")
     repository = Repository.open(self.repos_url)
     self.assertEquals(ListBranchingScheme(["trunk", "branches/*", "branches/tmp/*"]).branch_list,
                       repository.get_mapping().scheme.branch_list)
Esempio n. 2
0
def get_property_scheme(repository, revnum=None):
    if revnum is None:
        revnum = repository.get_latest_revnum()
    text = repository.branchprop_list.get_properties("", revnum).get(
        SVN_PROP_BZR_BRANCHING_SCHEME, None)
    if text is None:
        return None
    return ListBranchingScheme(parse_list_scheme_text(text))
Esempio n. 3
0
 def test_is_branch_wildcard_multiple(self):
     scheme = ListBranchingScheme(["*/trunk/*"])
     self.assertTrue(scheme.is_branch("bla/trunk/bloe"))
     self.assertFalse(scheme.is_branch("bla/trunk"))
     self.assertFalse(scheme.is_branch("trunk/bloe"))
     self.assertFalse(scheme.is_branch("blie/trunk/bloe/bla"))
     self.assertFalse(scheme.is_branch("bla"))
Esempio n. 4
0
 def test_set_property_scheme(self):
     self.make_checkout(self.repos_url, 'dc')
     repos = Repository.open(self.repos_url)
     set_property_scheme(repos, ListBranchingScheme(["bla/*"]))
     self.client_update("dc")
     self.assertEquals("bla/*\n",
                self.client_get_prop("dc", SVN_PROP_BZR_BRANCHING_SCHEME))
     self.assertEquals("Updating branching scheme for Bazaar.",
             self.client_log(self.repos_url, 1, 1)[1][3])
Esempio n. 5
0
 def test_unprefix_wildcard_nonexistant(self):
     scheme = ListBranchingScheme(["*/trunk"])
     self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "bla")
     self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "trunk")
     self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix,
                       "trunk/bla")
Esempio n. 6
0
 def test_unprefix_wildcard_multiple(self):
     scheme = ListBranchingScheme(["trunk/*/*"])
     self.assertEquals(("trunk/foo/bar", "trunk/foo/bar", "bla/blie"),
                       scheme.unprefix("trunk/foo/bar/bla/blie"))
Esempio n. 7
0
 def test_unprefix_wildcard(self):
     scheme = ListBranchingScheme(["*/trunk"])
     self.assertEquals(("bla/trunk", "bla/trunk", "foo"),
                       scheme.unprefix("bla/trunk/foo"))
Esempio n. 8
0
 def test_is_tag_parent_other(self):
     self.assertFalse(
         ListBranchingScheme(["trunk"]).is_tag_parent("trunk/foo"))
Esempio n. 9
0
 def test_is_branch_parent_root(self):
     self.assertTrue(
         ListBranchingScheme(["trunk/*"]).is_branch_parent("trunk"))
Esempio n. 10
0
 def test_is_branch_parent_root_root(self):
     self.assertFalse(ListBranchingScheme([""]).is_branch_parent(""))
Esempio n. 11
0
 def test_is_branch_wildcard_root(self):
     scheme = ListBranchingScheme(["*/trunk"])
     self.assertTrue(scheme.is_branch("bla/trunk"))
     self.assertFalse(scheme.is_branch("trunk"))
     self.assertFalse(scheme.is_branch("bla"))
Esempio n. 12
0
 def test_is_branch_wildcard(self):
     scheme = ListBranchingScheme(["trunk/*"])
     self.assertTrue(scheme.is_branch("trunk/foo"))
     self.assertFalse(scheme.is_branch("trunk"))
Esempio n. 13
0
 def test_create_from_string(self):
     self.scheme = ListBranchingScheme(
         'QlpoOTFBWSZTWXb2s-UAAADBAAAQAQCgACGYGYQYXckU4UJB29rPlA..')
     self.assertEquals(["foo"], self.scheme.branch_list)
Esempio n. 14
0
 def setUp(self):
     TestCase.setUp(self)
     self.scheme = ListBranchingScheme(["foo", "bar/bloe"])
Esempio n. 15
0
class ListScheme(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        self.scheme = ListBranchingScheme(["foo", "bar/bloe"])

    def test_create_from_string(self):
        self.scheme = ListBranchingScheme(
            'QlpoOTFBWSZTWXb2s-UAAADBAAAQAQCgACGYGYQYXckU4UJB29rPlA..')
        self.assertEquals(["foo"], self.scheme.branch_list)

    def test_is_tag_empty(self):
        self.assertFalse(self.scheme.is_tag(""))

    def test_is_tag_sub(self):
        self.assertFalse(self.scheme.is_tag("foo"))

    def test_is_tag_tag(self):
        self.assertFalse(self.scheme.is_tag("tags/foo"))

    def test_is_branch_empty(self):
        self.assertFalse(self.scheme.is_branch(""))

    def test_is_branch_slash(self):
        self.assertFalse(self.scheme.is_branch("/"))

    def test_is_branch_wildcard(self):
        scheme = ListBranchingScheme(["trunk/*"])
        self.assertTrue(scheme.is_branch("trunk/foo"))
        self.assertFalse(scheme.is_branch("trunk"))

    def test_is_branch_wildcard_root(self):
        scheme = ListBranchingScheme(["*/trunk"])
        self.assertTrue(scheme.is_branch("bla/trunk"))
        self.assertFalse(scheme.is_branch("trunk"))
        self.assertFalse(scheme.is_branch("bla"))

    def test_is_branch_wildcard_multiple(self):
        scheme = ListBranchingScheme(["*/trunk/*"])
        self.assertTrue(scheme.is_branch("bla/trunk/bloe"))
        self.assertFalse(scheme.is_branch("bla/trunk"))
        self.assertFalse(scheme.is_branch("trunk/bloe"))
        self.assertFalse(scheme.is_branch("blie/trunk/bloe/bla"))
        self.assertFalse(scheme.is_branch("bla"))

    def test_is_branch_parent_root_root(self):
        self.assertFalse(ListBranchingScheme([""]).is_branch_parent(""))

    def test_is_branch_parent_root(self):
        self.assertTrue(
            ListBranchingScheme(["trunk/*"]).is_branch_parent("trunk"))

    def test_is_branch_parent_other(self):
        self.assertFalse(
            ListBranchingScheme(["trunk/*"]).is_branch_parent("trunk/foo"))

    def test_is_tag_parent_other(self):
        self.assertFalse(
            ListBranchingScheme(["trunk"]).is_tag_parent("trunk/foo"))

    def test_is_branch_slashsub(self):
        self.assertTrue(self.scheme.is_branch("/foo"))

    def test_is_branch_sub(self):
        self.assertTrue(self.scheme.is_branch("foo"))

    def test_is_branch_sub_sub_slash(self):
        self.assertFalse(self.scheme.is_branch("/foo/foo"))

    def test_is_branch_sub_sub(self):
        self.assertFalse(self.scheme.is_branch("foo/bar"))

    def test_is_branch_unknown(self):
        self.assertFalse(self.scheme.is_branch("foobla"))

    def test_is_branch_doubleslash(self):
        self.assertTrue(self.scheme.is_branch("//foo/"))

    def test_is_branch_nested(self):
        self.assertTrue(self.scheme.is_branch("bar/bloe"))

    def test_unprefix_notbranch_empty(self):
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "")

    def test_unprefix_wildcard(self):
        scheme = ListBranchingScheme(["*/trunk"])
        self.assertEquals(("bla/trunk", "bla/trunk", "foo"),
                          scheme.unprefix("bla/trunk/foo"))

    def test_unprefix_wildcard_multiple(self):
        scheme = ListBranchingScheme(["trunk/*/*"])
        self.assertEquals(("trunk/foo/bar", "trunk/foo/bar", "bla/blie"),
                          scheme.unprefix("trunk/foo/bar/bla/blie"))

    def test_unprefix_wildcard_nonexistant(self):
        scheme = ListBranchingScheme(["*/trunk"])
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "bla")
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "trunk")
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix,
                          "trunk/bla")

    def test_unprefix_notbranch_slash(self):
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix, "/")

    def test_unprefix_notbranch_unknown(self):
        self.assertRaises(InvalidSvnBranchPath, self.scheme.unprefix,
                          "blie/bloe/bla")

    def test_unprefix_branch_slash(self):
        self.assertEqual(self.scheme.unprefix("/foo"), ("foo", "foo", ""))

    def test_unprefix_branch(self):
        self.assertEqual(self.scheme.unprefix("foo"), ("foo", "foo", ""))

    def test_unprefix_nested_slash(self):
        self.assertEqual(self.scheme.unprefix("/foo/foo"),
                         ("foo", "foo", "foo"))

    def test_unprefix_nested(self):
        self.assertEqual(self.scheme.unprefix("foo/bar"),
                         ("foo", "foo", "bar"))

    def test_unprefix_double_nested(self):
        self.assertEqual(self.scheme.unprefix("foo/bar/bla"),
                         ("foo", "foo", "bar/bla"))

    def test_unprefix_double_slash(self):
        self.assertEqual(self.scheme.unprefix("//foo/"), ("foo", "foo", ""))

    def test_unprefix_nested_branch(self):
        self.assertEqual(self.scheme.unprefix("bar/bloe"),
                         ("bar/bloe", "bar/bloe", ""))

    def test_str(self):
        self.assertEqual(
            "list-QlpoOTFBWSZTWSDz6woAAAPRgAAQAACzBJAAIAAiDRo9QgyYjmbjatAeLuSKcKEgQefWFA..",
            str(self.scheme))

    def test_parse_text(self):
        self.assertEqual(["bla/bloe"], parse_list_scheme_text("bla/bloe\n"))

    def test_parse_text_no_newline(self):
        self.assertEqual(["bla/bloe", "blie"],
                         parse_list_scheme_text("bla/bloe\nblie"))

    def test_parse_text_comment(self):
        self.assertEqual(["bla/bloe", "blie"],
                         parse_list_scheme_text("bla/bloe\n# comment\nblie"))