Rev 469: Implement create_branch(). in file:///home/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Mon May 28 13:27:47 BST 2007


------------------------------------------------------------
revno: 469
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-05-28 14:24:15 +0200
message:
  Implement create_branch().
modified:
  NEWS
  format.py
  repository.py
  tests/test_radir.py
=== modified file 'NEWS'
--- a/NEWS	2007-05-27 19:33:30 +0000
+++ b/NEWS	2007-05-28 12:24:15 +0000
@@ -28,7 +28,9 @@
 
   INTERNALS
 
-   * Implement SvnRaTransport.local_abspath() (#117090)
+   * Implement SvnRaTransport.local_abspath(). (#117090)
+
+   * Implement SvnRemoteAccess.create_branch().
 
 bzr-svn 0.3.4	UNRELEASED
 

=== modified file 'format.py'
--- a/format.py	2007-05-18 18:01:27 +0000
+++ b/format.py	2007-05-28 12:24:15 +0000
@@ -124,9 +124,13 @@
     def create_branch(self):
         """See BzrDir.create_branch()."""
         from branch import SvnBranch
-        repos = self.open_repository()
-        # TODO: Check if there are any revisions in this repository 
-        # yet if it is the top-level one
+        repos = self.find_repository()
+
+        if self.branch_path != "":
+            self.root_transport.mkdir(".")
+        else:
+            # TODO: Check if there are any revisions in this repository yet
+            pass
         branch = SvnBranch(self.root_transport.base, repos, self.branch_path)
         branch.bzrdir = self
         return branch

=== modified file 'repository.py'
--- a/repository.py	2007-05-27 16:35:12 +0000
+++ b/repository.py	2007-05-28 12:24:15 +0000
@@ -443,6 +443,9 @@
             assert isinstance(branch_path, str)
             if uuid == self.uuid:
                 return (branch_path, revnum)
+            # If the UUID doesn't match, this may still be a valid revision
+            # id; a revision from another SVN repository may be pushed into 
+            # this one.
         except InvalidRevisionId:
             pass
 

=== modified file 'tests/test_radir.py'
--- a/tests/test_radir.py	2007-05-17 16:52:31 +0000
+++ b/tests/test_radir.py	2007-05-28 12:24:15 +0000
@@ -20,7 +20,10 @@
 from bzrlib.errors import (NoRepositoryPresent, NotBranchError, NotLocalUrl,
                            NoWorkingTree)
 
+import svn
+
 from tests import TestCaseWithSubversionRepository
+from transport import SvnRaTransport
 
 class TestRemoteAccess(TestCaseWithSubversionRepository):
     def test_clone(self):
@@ -46,6 +49,21 @@
         x = BzrDir.open(repos_url)
         self.assertRaises(NotLocalUrl, x.create_workingtree)
 
+    def test_create_branch_top(self):
+        repos_url = self.make_client("d", "dc")
+        x = BzrDir.open(repos_url)
+        b = x.create_branch()
+        self.assertEquals(repos_url, b.base)
+
+    def test_create_branch_nested(self):
+        repos_url = self.make_client("d", "dc")
+        x = BzrDir.open(repos_url+"/trunk")
+        b = x.create_branch()
+        self.assertEquals(repos_url+"/trunk", b.base)
+        transport = SvnRaTransport(repos_url)
+        self.assertEquals(svn.core.svn_node_dir, 
+                transport.check_path("trunk", 1))
+
     def test_bad_dir(self):
         repos_url = self.make_client("d", "dc")
         self.build_tree({"dc/foo": None})




More information about the bazaar-commits mailing list