Rev 716: Implement ListBranchingScheme.is_branch_parent(). in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Wed Oct 17 01:14:30 BST 2007


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 716
revision-id: jelmer at samba.org-20070924190759-93ewsf9v76il6u1b
parent: jelmer at samba.org-20070924133525-6rkz6tth4oo8cfht
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-09-24 21:07:59 +0200
message:
  Implement ListBranchingScheme.is_branch_parent().
modified:
  FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
  tests/test_scheme.py           test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
=== modified file 'FAQ'
--- a/FAQ	2007-09-19 20:58:46 +0000
+++ b/FAQ	2007-09-24 19:07:59 +0000
@@ -43,7 +43,7 @@
 At the moment, only `bzr svn-push` can be used to push new branches into 
 Subversion. 
 
-More information can be found in the bug report at 
+More information can be found in the bug report at:
 https://bugs.launchpad.net/bzr-svn/+bug/127945.
 
 ==============================================
@@ -53,7 +53,7 @@
 the history from the Subversion branch as it doesn't support so-called 
 history horizons yet. 
 
-For more information about history horizons can be found at:
+More information about history horizons can be found at:
 http://bazaar-vcs.org/HistoryHorizon
 
 =====================================================

=== modified file 'NEWS'
--- a/NEWS	2007-09-24 13:35:25 +0000
+++ b/NEWS	2007-09-24 19:07:59 +0000
@@ -14,6 +14,8 @@
    * Handle NULL_REVISION in SvnRepository.copy_content(). Fixes compatibility 
      with bzr merge-into.
 
+   * Implement ListBranchingScheme.is_branch_parent().
+
   BUG FIXES
 
    * Handle long file names with unicode characters correctly on python2.4 (#129334)

=== modified file 'scheme.py'
--- a/scheme.py	2007-08-09 14:54:13 +0000
+++ b/scheme.py	2007-09-24 19:07:59 +0000
@@ -173,6 +173,19 @@
     def to_lines(self):
         return self.branch_list
 
+    def is_tag_parent(self, path):
+        # ListBranchingScheme doesn't have tags
+        return False
+
+    def is_branch_parent(self, path):
+        parts = path.strip("/").split("/")
+        for pattern in self.split_branch_list:
+            if len(parts) == len(pattern):
+                continue
+            if self._pattern_cmp(parts, pattern[0:len(parts)]):
+                return True
+        return False
+
 
 class NoBranchingScheme(ListBranchingScheme):
     """Describes a scheme where there is just one branch, the 

=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py	2007-08-03 13:52:24 +0000
+++ b/tests/test_scheme.py	2007-09-24 19:07:59 +0000
@@ -172,6 +172,18 @@
         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"))
 




More information about the bazaar-commits mailing list