[MERGE] Get BzrDir.cloning_metadir working remotely

John Arbash Meinel john at arbash-meinel.com
Tue Mar 3 03:37:19 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> Less round trips. Repeat the manta. Vote now for bzr for presidente.
> 

BB:comment

+    def cloning_metadir(self, require_stacking=False):
+        medium = self._client._medium
+        if medium._is_remote_before((1, 13)):
+            return
self._vfs_cloning_metadir(require_stacking=require_stacking)
+        verb = 'BzrDir.cloning_metadir'
+        if require_stacking:
+            stacking = 'True'
+        else:
+            stacking = 'False'
+        path = self._path_for_remote_call(self._client)
+        try:
+            response = self._call(verb, path, stacking)
+        except errors.UnknownSmartMethod:
+            return
self._vfs_cloning_metadir(require_stacking=require_stacking)

^- Shouldn't you be setting 'medium._remote_is_XXX' when the call fails?

...
+class SmartServerBzrDirRequestCloningMetaDir(SmartServerRequestBzrDir):
+
+    def do_bzrdir_request(self, require_stacking):
+        """Get the format that should be used when cloning from this
dir."""
+        if require_stacking == "True":
+            require_stacking = True
+        else:
+            require_stacking = False
+        control_format = self._bzrdir.cloning_metadir(
+            require_stacking=require_stacking)
+        control_name = control_format.network_name()
+        # XXX: Should be a method that tells us this, or delegated to the
+        # format, or something.
+        if isinstance(control_format, BzrDirMetaFormat1):
+            branch_name = control_format.get_branch_format().network_name()
+            repository_name =
control_format.repository_format.network_name()
+        else:
+            # Only MetaDir has delegated formats today.
+            branch_name = ''
+            repository_name = ''
+        return SuccessfulSmartServerResponse((control_name,
repository_name,
+            branch_name))
+

^- Is the XXX still valid, isn't this what 'network_name()' is all about?


John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmspe8ACgkQJdeBCYSNAAOITQCfWKDOTyVNbZSeD/VZ67zShQjM
2oIAoNI81sD5SsvKvkgYAuydTCrfxHX4
=7EnP
-----END PGP SIGNATURE-----



More information about the bazaar mailing list