~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Fix setting config options to support unicode values and don't attempt to reset repositories _fallback_repositories as the simple approach fails to work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
917
917
        if isinstance(repository, RemoteRepository):
918
918
            raise AssertionError()
919
919
        self._real_repository = repository
920
 
        # If the _real_repository has _fallback_repositories, clear them out,
921
 
        # because we want it to have the same set as this repository.  This is
922
 
        # reasonable to do because the fallbacks we clear here are from a
923
 
        # "real" branch, and we're about to replace them with the equivalents
924
 
        # from a RemoteBranch.
925
 
        self._real_repository._fallback_repositories = []
 
920
        if (len(self._real_repository._fallback_repositories) !=
 
921
            len(self._fallback_repositories)):
 
922
            if len(self._real_repository._fallback_repositories):
 
923
                raise AssertionError(
 
924
                    "cannot cleanly remove existing _fallback_repositories")
926
925
        for fb in self._fallback_repositories:
927
926
            self._real_repository.add_fallback_repository(fb)
928
927
        if self._lock_mode == 'w':
2411
2410
            path = self._branch._remote_path()
2412
2411
            response = self._branch._client.call('Branch.set_config_option',
2413
2412
                path, self._branch._lock_token, self._branch._repo_lock_token,
2414
 
                value, name, section or '')
 
2413
                value.encode('utf8'), name, section or '')
2415
2414
        except errors.UnknownSmartMethod:
2416
2415
            medium._remember_remote_is_before((1, 14))
2417
2416
            return self._vfs_set_option(value, name, section)