Rev 527: Add __str__ to ListBranchingScheme. in file:///data/jelmer/bzr-svn/0.4/
Jelmer Vernooij
jelmer at samba.org
Fri Jul 13 11:40:09 BST 2007
At file:///data/jelmer/bzr-svn/0.4/
------------------------------------------------------------
revno: 527
revision-id: jelmer at samba.org-20070713101121-mor3bvltp2pyjheo
parent: jelmer at samba.org-20070713094309-y3e5iduu3g3anxqw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2007-07-13 13:11:21 +0300
message:
Add __str__ to ListBranchingScheme.
modified:
scheme.py scheme.py-20060516195850-95181aae6b272f9e
tests/test_scheme.py test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
=== modified file 'scheme.py'
--- a/scheme.py 2007-07-05 02:09:17 +0000
+++ b/scheme.py 2007-07-13 10:11:21 +0000
@@ -16,6 +16,7 @@
"""Branching scheme implementations."""
from bzrlib.errors import NotBranchError, BzrError
+from bzrlib.osutils import sha_strings
class BranchingScheme:
""" Divides SVN repository data up into branches. Since there
@@ -53,10 +54,9 @@
@staticmethod
def find_scheme(name):
- if name == "trunk":
- return TrunkBranchingScheme()
-
if name.startswith("trunk"):
+ if name == "trunk":
+ return TrunkBranchingScheme()
try:
return TrunkBranchingScheme(level=int(name[len("trunk"):]))
except ValueError:
@@ -91,6 +91,7 @@
def is_tag(self, path):
raise NotImplementedError
+
class TrunkBranchingScheme(BranchingScheme):
"""Standard Subversion repository layout. Each project contains three
directories `trunk', `tags' and `branches'.
@@ -182,6 +183,9 @@
for p in branch_list:
self.branch_list.append(p.strip("/"))
+ def __str__(self):
+ return "list-%s" % sha_strings(self.branch_list)
+
def is_tag(self, path):
"""See BranchingScheme.is_tag()."""
return False
=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py 2007-07-05 02:09:17 +0000
+++ b/tests/test_scheme.py 2007-07-13 10:11:21 +0000
@@ -210,6 +210,9 @@
def test_unprefix_nested_branch(self):
self.assertEqual(self.scheme.unprefix("bar/bloe"), ("bar/bloe", ""))
+ def test_str(self):
+ self.assertEqual("list-ffcc22c56739f8d862c2a7578274dd2649565451", str(self.scheme))
+
class TrunkScheme(TestCase):
def test_is_branch_empty(self):
self.assertFalse(TrunkBranchingScheme().is_branch(""))
More information about the bazaar-commits
mailing list