Rev 529: Support parsing list scheme texts. in file:///data/jelmer/bzr-svn/0.4/
Jelmer Vernooij
jelmer at samba.org
Fri Jul 13 11:40:00 BST 2007
At file:///data/jelmer/bzr-svn/0.4/
------------------------------------------------------------
revno: 529
revision-id: jelmer at samba.org-20070713102746-i2dygg1cv2ke9eiw
parent: jelmer at samba.org-20070713101734-yvgxs558lh7lcvu2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2007-07-13 13:27:46 +0300
message:
Support parsing list scheme texts.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
scheme.py scheme.py-20060516195850-95181aae6b272f9e
tests/test_scheme.py test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
=== modified file 'NEWS'
--- a/NEWS 2007-07-12 12:42:22 +0000
+++ b/NEWS 2007-07-13 10:27:46 +0000
@@ -44,6 +44,8 @@
* add -v option to svn-upgrade
+ * store and allow setting the branching scheme in subversion.conf
+
INTERNALS
* Implement SvnRaTransport.local_abspath(). (#117090)
=== modified file 'TODO'
--- a/TODO 2007-07-10 15:01:36 +0000
+++ b/TODO 2007-07-13 10:27:46 +0000
@@ -10,11 +10,11 @@
- simplify find_branches by using Transport.list_dir() ?
- fix autorealm repository
- avoid extra connect in logwalker?
-- allow branching scheme specified in magic property in repository root
- free memory!
- report changes to delta editor in Branch.pull()
- more blackbox tests
- transform file ids in workingtree in svn-upgrade
+- allow branching scheme specified in magic property in repository root
- more intelligent mechanism for finding branching scheme. Look at directory structure in current tree?
working trees:
=== modified file 'scheme.py'
--- a/scheme.py 2007-07-13 10:17:34 +0000
+++ b/scheme.py 2007-07-13 10:27:46 +0000
@@ -179,6 +179,15 @@
return False
+def parse_list_scheme_text(text):
+ branches = []
+ for l in text.splitlines():
+ if l.startswith("#"):
+ continue
+ branches.append(l.strip("/"))
+ return branches
+
+
class ListBranchingScheme(BranchingScheme):
def __init__(self, branch_list):
"""Create new ListBranchingScheme instance.
@@ -206,9 +215,9 @@
for i in self.branch_list:
if (path+"/").startswith(i+"/"):
return (i, path[len(i):].strip("/"))
-
raise NotBranchError(path=path)
+
class UnknownBranchingScheme(BzrError):
_fmt = "Branching scheme could not be found: %(name)s"
=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py 2007-07-13 10:11:21 +0000
+++ b/tests/test_scheme.py 2007-07-13 10:27:46 +0000
@@ -21,8 +21,8 @@
from bzrlib.tests import TestCase
from scheme import (ListBranchingScheme, NoBranchingScheme,
BranchingScheme, TrunkBranchingScheme,
- SingleBranchingScheme,
- UnknownBranchingScheme)
+ SingleBranchingScheme, UnknownBranchingScheme,
+ parse_list_scheme_text)
class BranchingSchemeTest(TestCase):
def test_is_branch(self):
@@ -213,6 +213,15 @@
def test_str(self):
self.assertEqual("list-ffcc22c56739f8d862c2a7578274dd2649565451", 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"))
+
class TrunkScheme(TestCase):
def test_is_branch_empty(self):
self.assertFalse(TrunkBranchingScheme().is_branch(""))
More information about the bazaar-commits
mailing list