Rev 1435: Implement get_branch_path for branching scheme v3. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Fri Jul 4 09:20:13 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1435
revision-id: jelmer at samba.org-20080704082012-h5rw2gghz5zeo93u
parent: jelmer at samba.org-20080704064143-drswm948f45gra9i
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2008-07-04 10:20:12 +0200
message:
Implement get_branch_path for branching scheme v3.
modified:
mapping3/scheme.py scheme.py-20060516195850-95181aae6b272f9e
tests/test_scheme.py test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
=== modified file 'mapping3/scheme.py'
--- a/mapping3/scheme.py 2008-07-03 20:33:27 +0000
+++ b/mapping3/scheme.py 2008-07-04 08:20:12 +0000
@@ -54,6 +54,13 @@
"""
raise NotImplementedError
+ def get_branch_path(self, name):
+ """Find the path for a named branch.
+
+ :param name: Branch name.
+ """
+ raise NotImplementedError
+
@staticmethod
def find_scheme(name):
"""Find a branching scheme by name.
@@ -259,6 +266,15 @@
return urlutils.join("tags", name)
raise NotImplementedError
+ def get_branch_path(self, name):
+ # Only implemented for level 0
+ if self.level == 0:
+ if name == "trunk":
+ return "trunk"
+ else:
+ return urlutils.join("branches", name)
+ raise NotImplementedError
+
def is_branch(self, path):
"""See BranchingScheme.is_branch()."""
parts = path.strip("/").split("/")
=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py 2008-07-03 20:33:27 +0000
+++ b/tests/test_scheme.py 2008-07-04 08:20:12 +0000
@@ -454,6 +454,19 @@
self.assertRaises(NotImplementedError,
TrunkBranchingScheme(2).get_tag_path, "foo")
+ def test_get_branch_path_zero(self):
+ self.assertEquals("branches/foo",
+ TrunkBranchingScheme().get_branch_path("foo"))
+
+ def test_get_branch_path_zero_trunk(self):
+ self.assertEquals("trunk",
+ TrunkBranchingScheme().get_branch_path("trunk"))
+
+ def test_get_branch_path_nonzero(self):
+ self.assertRaises(NotImplementedError,
+ TrunkBranchingScheme(2).get_branch_path, "foo")
+
+
class SingleBranchingSchemeTests(TestCase):
More information about the bazaar-commits
mailing list