~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Andrew Bennetts
  • Date: 2010-05-13 16:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 5232.
  • Revision ID: andrew.bennetts@canonical.com-20100513161754-q2ak6vzjnur7f3i3
Add Branch.set_config_option_dict RPC (and VFS fallback), fixes #430382.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Server-side branch related request implmentations."""
18
18
 
19
19
 
20
 
from bzrlib import errors
 
20
from bzrlib import (
 
21
    bencode,
 
22
    errors,
 
23
    )
21
24
from bzrlib.bzrdir import BzrDir
22
25
from bzrlib.smart.request import (
23
26
    FailedSmartServerResponse,
194
197
        return SuccessfulSmartServerResponse(())
195
198
 
196
199
 
 
200
class SmartServerBranchRequestSetConfigOptionDict(SmartServerLockedBranchRequest):
 
201
    """Set an option in the branch configuration.
 
202
    
 
203
    New in 2.2.
 
204
    """
 
205
 
 
206
    def do_with_locked_branch(self, branch, value_dict, name, section):
 
207
        utf8_dict = bencode.bdecode(value_dict)
 
208
        value_dict = {}
 
209
        for key, value in utf8_dict.items():
 
210
            value_dict[key.decode('utf8')] = value.decode('utf8')
 
211
        if not section:
 
212
            section = None
 
213
        branch._get_config().set_option(value_dict, name, section)
 
214
        return SuccessfulSmartServerResponse(())
 
215
 
 
216
 
197
217
class SmartServerBranchRequestSetLastRevision(SmartServerSetTipRequest):
198
218
 
199
219
    def do_tip_change_with_locked_branch(self, branch, new_last_revision_id):