Rev 441: Initial work on supporting "upgrades" of .svn directories to .bzr directories. in sftp://people.samba.org/~/bzr/bzr-svn/0.3/

Jelmer Vernooij jelmer at samba.org
Tue Apr 3 13:51:27 BST 2007


At sftp://people.samba.org/~/bzr/bzr-svn/0.3/

------------------------------------------------------------
revno: 441
revision-id: jelmer at samba.org-20070403125101-53li3xzbpbsxryb3
parent: jelmer at samba.org-20070325151508-eliztm1ms969fjk8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-04-03 14:51:01 +0200
message:
  Initial work on supporting "upgrades" of .svn directories to .bzr directories.
modified:
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  checkout.py                    workingtree.py-20060306120941-b083cb0fdd4a69de
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
  format.py                      format.py-20060406233823-b6fa009fe35dfde7
  tests/test_checkout.py         test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
=== modified file 'TODO'
--- a/TODO	2007-03-25 14:41:44 +0000
+++ b/TODO	2007-04-03 12:51:01 +0000
@@ -18,3 +18,4 @@
 - add tests for objects returned by WorkingTree.pull(), Branch.pull()
 - blackbox tests
 - test Branch.get_parent()
+- split fetch tests out of test_repos

=== modified file 'checkout.py'
--- a/checkout.py	2007-03-24 15:40:13 +0000
+++ b/checkout.py	2007-04-03 12:51:01 +0000
@@ -30,6 +30,7 @@
 from bzrlib.workingtree import WorkingTree, WorkingTreeFormat
 
 from branch import SvnBranch
+from convert import SvnConverter
 from repository import (SvnRepository, escape_svn_path, SVN_PROP_BZR_MERGE,
                         SVN_PROP_SVK_MERGE, SVN_PROP_BZR_FILEIDS, 
                         revision_id_to_svk_feature) 
@@ -711,3 +712,9 @@
 
     def initialize_on_transport(self, transport):
         raise NotImplementedError(self.initialize_on_transport)
+
+    def get_converter(self, format=None):
+        """See BzrDirFormat.get_converter()."""
+        if format is None:
+            format = BzrDirFormat.get_default_format()
+        return SvnConverter(format)

=== modified file 'convert.py'
--- a/convert.py	2007-03-25 14:41:44 +0000
+++ b/convert.py	2007-04-03 12:51:01 +0000
@@ -20,7 +20,7 @@
 from bzrlib.plugin import load_plugins
 load_plugins()
 
-from bzrlib.bzrdir import BzrDir, BzrDirFormat
+from bzrlib.bzrdir import BzrDir, BzrDirFormat, Converter
 from bzrlib.branch import Branch
 from bzrlib.errors import (BzrError, NotBranchError, 
                            NoSuchFile, NoRepositoryPresent)
@@ -68,7 +68,6 @@
                        working_trees=False, all=False):
     assert not all or create_shared_repo
 
-
     if os.path.isfile(url):
         tmp_repos = tempfile.mkdtemp(prefix='bzr-svn-dump-')
         mutter('loading dumpfile %r to %r' % (url, tmp_repos))
@@ -143,3 +142,12 @@
     finally:
         if tmp_repos:
             osutils.rmtree(tmp_repos)
+
+
+class SvnConverter(Converter):
+    """Converts from a Subversion dir to another dir."""
+    def __init__(self, target_format):
+        self.target_format = target_format
+
+    def convert(self, to_convert, pb):
+        pass

=== modified file 'format.py'
--- a/format.py	2007-03-25 14:41:44 +0000
+++ b/format.py	2007-04-03 12:51:01 +0000
@@ -181,3 +181,4 @@
     def is_supported(self):
         """See BzrDir.is_supported()."""
         return True
+

=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py	2007-03-25 14:41:44 +0000
+++ b/tests/test_checkout.py	2007-04-03 12:51:01 +0000
@@ -18,7 +18,8 @@
 from bzrlib.errors import NoRepositoryPresent
 from bzrlib.tests import TestCase
 
-from checkout import SvnWorkingTreeFormat
+from convert import SvnConverter
+from checkout import SvnWorkingTreeFormat, SvnWorkingTreeDirFormat
 from tests import TestCaseWithSubversionRepository
 
 class TestWorkingTreeFormat(TestCase):
@@ -36,6 +37,14 @@
     def test_open(self):
         self.assertRaises(NotImplementedError, self.format.open, None)
 
+class TestCheckoutFormat(TestCase):
+    def setUp(self):
+        super(TestCheckoutFormat, self).setUp()
+        self.format = SvnWorkingTreeDirFormat()
+
+    def test_get_converter(self):
+        self.assertIsInstance(self.format.get_converter(), SvnConverter)
+
 
 class TestCheckout(TestCaseWithSubversionRepository):
     def test_not_for_writing(self):




More information about the bazaar-commits mailing list