1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
from bzrlib.tests import (
20
from bzrlib.plugins.svn import errors as svn_errors
22
from bzrlib.plugins.svn.layout.custom import (
27
class KDELayoutTests(TestCase):
31
self.layout = KDELayout()
34
self.assertEquals("KDELayout()", repr(self.layout))
37
self.assertEquals("kde", str(self.layout))
39
def test_get_project_prefixes(self):
43
"tags/KDE"], self.layout.get_project_prefixes("KDE/kdebase"))
45
def test_get_path(self):
46
self.assertEquals("tags/KDE/1.0/kdebase",
47
self.layout.get_tag_path("1.0", "KDE/kdebase"))
48
self.assertEquals("tags/k3b/3.0",
49
self.layout.get_tag_path("3.0", "k3b"))
51
def test_is_branch_parent(self):
52
self.assertTrue(self.layout.is_branch_parent(""))
53
self.assertTrue(self.layout.is_branch_parent("trunk"))
54
self.assertTrue(self.layout.is_branch_parent("trunk/KDE"))
55
self.assertTrue(self.layout.is_branch_parent("branches"))
56
self.assertTrue(self.layout.is_branch_parent("branches/KDE/2.0"))
57
self.assertFalse(self.layout.is_branch_parent("branches/something/2.0"))
58
self.assertTrue(self.layout.is_branch_parent("branches/KDE"))
59
self.assertFalse(self.layout.is_branch_parent("branches/some"))
62
self.assertRaises(svn_errors.NotSvnBranchPath,
63
self.layout.parse, "branches")
64
self.assertRaises(svn_errors.NotSvnBranchPath,
65
self.layout.parse, "tags")
66
self.assertRaises(svn_errors.NotSvnBranchPath,
67
self.layout.parse, "trunk")
68
self.assertRaises(svn_errors.NotSvnBranchPath,
69
self.layout.parse, "branches/2.0")
70
self.assertRaises(svn_errors.NotSvnBranchPath,
71
self.layout.parse, "branches/KDE/2.0")
73
def test_parse_kdebase(self):
74
self.assertEquals(("branch", "KDE/kdebase", "trunk/KDE/kdebase", ""),
75
self.layout.parse("trunk/KDE/kdebase"))
76
self.assertEquals(("branch", "KDE/kdebase", "branches/KDE/2.0/kdebase", ""),
77
self.layout.parse("branches/KDE/2.0/kdebase"))
78
self.assertEquals(("branch", "KDE/kdebase", "branches/KDE/2.0/kdebase", "foo"),
79
self.layout.parse("branches/KDE/2.0/kdebase/foo"))
81
def test_get_tag_name(self):
82
self.assertEquals("mytag", self.layout.get_tag_name("tags/KDE/mytag/foo"))
83
self.assertEquals("bla", self.layout.get_tag_name("tags/k3b/bla"))