Rev 2102: Initial work to allow 'bzr upgrade' in working copies. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Sat Nov 29 16:26:49 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.5

------------------------------------------------------------
revno: 2102
revision-id: jelmer at samba.org-20081129162645-t7tmstaq00kk8lzw
parent: jelmer at samba.org-20081129051428-9zz2ijdqh5py2wqj
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Sat 2008-11-29 17:26:45 +0100
message:
  Initial work to allow 'bzr upgrade' in working copies.
modified:
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
  format.py                      format.py-20070917005147-94kb7zysotf82kqw-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
=== modified file 'convert.py'
--- a/convert.py	2008-11-27 02:10:35 +0000
+++ b/convert.py	2008-11-29 16:26:45 +0000
@@ -289,17 +289,3 @@
     if target_repos is not None:
         put_latest_svn_import_revision(target_repos, source_repos.uuid, to_revnum)
         
-
-class SvnConverter(bzrdir.Converter):
-    """Converts from a Subversion directory to a bzr dir."""
-    def __init__(self, target_format):
-        """Create a SvnConverter.
-        :param target_format: The format the resulting repository should be.
-        """
-        super(SvnConverter, self).__init__()
-        self.target_format = target_format
-
-    def convert(self, to_convert, pb):
-        """See Converter.convert()."""
-        convert_repository(to_convert.open_repository(), to_convert.base, 
-                           format=self.target_format, all=True, pb=pb)

=== modified file 'format.py'
--- a/format.py	2008-11-09 21:55:56 +0000
+++ b/format.py	2008-11-29 16:26:45 +0000
@@ -163,4 +163,5 @@
         """See BzrDirFormat.get_converter()."""
         if format is None:
             format = get_rich_root_format()
-        raise NotImplementedError(self.get_converter)
+        from bzrlib.plugins.svn.workingtree import SvnCheckoutConverter
+        return SvnCheckoutConverter(format)

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-11-21 16:13:14 +0000
+++ b/workingtree.py	2008-11-29 16:26:45 +0000
@@ -20,9 +20,13 @@
         osutils,
         urlutils,
         )
+from bzrlib.branch import (
+        BranchReferenceFormat,
+        )
 from bzrlib.bzrdir import (
         BzrDirFormat,
         BzrDir,
+        Converter,
         )
 from bzrlib.errors import (
         InvalidRevisionId,
@@ -793,6 +797,9 @@
         self.svn_controldir = os.path.join(self.local_path, get_adm_dir())
         self.root_transport = self.transport = transport
 
+    def backup_bzrdir(self, to_directory):
+        self.root_transport.copy_tree(".svn", to_directory)
+
     def get_remote_bzrdir(self):
         if self._remote_bzrdir is None:
             self._remote_bzrdir = SvnRemoteAccess(self.get_remote_transport())
@@ -870,3 +877,23 @@
         branch.bzrdir = self.get_remote_bzrdir()
  
         return branch
+
+
+class SvnCheckoutConverter(Converter):
+    """Converts from a Subversion directory to a bzr dir."""
+    def __init__(self, target_format):
+        """Create a SvnCheckoutConverter.
+        :param target_format: The format the resulting repository should be.
+        """
+        super(SvnCheckoutConverter, self).__init__()
+        self.target_format = target_format
+
+    def convert(self, to_convert, pb):
+        """See Converter.convert()."""
+        remote_branch = to_convert.open_branch()
+        bzrdir = self.target_format.initialize(to_convert.root_transport.base)
+        branch = BranchReferenceFormat().initialize(bzrdir, remote_branch)
+        wt = bzrdir.create_workingtree()
+        # FIXME: Convert working tree
+        to_convert.root_transport.delete_tree(".svn")
+        return bzrdir




More information about the bazaar-commits mailing list