~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
21
 
from bzrlib import branch, errors, repository, urlutils
 
21
from bzrlib import (
 
22
    bencode,
 
23
    branch,
 
24
    errors,
 
25
    repository,
 
26
    urlutils,
 
27
    )
22
28
from bzrlib.bzrdir import (
23
29
    BzrDir,
24
30
    BzrDirFormat,
425
431
        return SuccessfulSmartServerResponse((), content)
426
432
 
427
433
 
 
434
class SmartServerBzrDirRequestGetBranches(SmartServerRequestBzrDir):
 
435
 
 
436
    def do_bzrdir_request(self):
 
437
        """Get the branches in a control directory.
 
438
        
 
439
        The body is a bencoded dictionary, with values similar to the return
 
440
        value of the open branch request.
 
441
        """
 
442
        branches = self._bzrdir.get_branches()
 
443
        ret = {}
 
444
        for name, b in branches.iteritems():
 
445
            if name is None:
 
446
                name = ""
 
447
            ret[name] = ("branch", b._format.network_name())
 
448
        return SuccessfulSmartServerResponse(
 
449
            ("success", ), bencode.bencode(ret))
 
450
 
 
451
 
428
452
class SmartServerRequestInitializeBzrDir(SmartServerRequest):
429
453
 
430
454
    def do(self, path):