Rev 4233: Fix setting config options to support unicode values and don't attempt to reset repositories _fallback_repositories as the simple approach fails to work. in http://people.ubuntu.com/~robertc/baz2.0/pending/RemoteBranchConfig

Robert Collins robertc at robertcollins.net
Fri Apr 3 01:38:05 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/pending/RemoteBranchConfig

------------------------------------------------------------
revno: 4233
revision-id: robertc at robertcollins.net-20090403003753-0479w1mew25mfwkf
parent: robertc at robertcollins.net-20090402052242-k2u70zdxabxwh2il
committer: Robert Collins <robertc at robertcollins.net>
branch nick: RemoteBranchConfig
timestamp: Fri 2009-04-03 11:37:53 +1100
message:
  Fix setting config options to support unicode values and don't attempt to reset repositories _fallback_repositories as the simple approach fails to work.
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-04-02 05:22:42 +0000
+++ b/bzrlib/remote.py	2009-04-03 00:37:53 +0000
@@ -917,12 +917,11 @@
         if isinstance(repository, RemoteRepository):
             raise AssertionError()
         self._real_repository = repository
-        # If the _real_repository has _fallback_repositories, clear them out,
-        # because we want it to have the same set as this repository.  This is
-        # reasonable to do because the fallbacks we clear here are from a
-        # "real" branch, and we're about to replace them with the equivalents
-        # from a RemoteBranch.
-        self._real_repository._fallback_repositories = []
+        if (len(self._real_repository._fallback_repositories) !=
+            len(self._fallback_repositories)):
+            if len(self._real_repository._fallback_repositories):
+                raise AssertionError(
+                    "cannot cleanly remove existing _fallback_repositories")
         for fb in self._fallback_repositories:
             self._real_repository.add_fallback_repository(fb)
         if self._lock_mode == 'w':
@@ -2411,7 +2410,7 @@
             path = self._branch._remote_path()
             response = self._branch._client.call('Branch.set_config_option',
                 path, self._branch._lock_token, self._branch._repo_lock_token,
-                value, name, section or '')
+                value.encode('utf8'), name, section or '')
         except errors.UnknownSmartMethod:
             medium._remember_remote_is_before((1, 14))
             return self._vfs_set_option(value, name, section)

=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py	2009-04-02 05:22:42 +0000
+++ b/bzrlib/smart/branch.py	2009-04-03 00:37:53 +0000
@@ -154,7 +154,7 @@
     def do_with_locked_branch(self, branch, value, name, section):
         if not section:
             section = None
-        branch._get_config().set_option(value, name, section)
+        branch._get_config().set_option(value.decode('utf8'), name, section)
         return SuccessfulSmartServerResponse(())
 
 




More information about the bazaar-commits mailing list