~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

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,
268
274
            self.transport_from_client_path(path))
269
275
        format = branch.network_format_registry.get(network_name)
270
276
        bzrdir.branch_format = format
271
 
        result = format.initialize(bzrdir)
 
277
        result = format.initialize(bzrdir, name="")
272
278
        rich_root, tree_ref, external_lookup = self._format_to_capabilities(
273
279
            result.repository._format)
274
280
        branch_format = result._format.network_name()
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):