~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.smart.request import SmartServerRequest, SmartServerResponse
23
23
 
24
24
 
 
25
class SmartServerRequestOpenBzrDir(SmartServerRequest):
 
26
 
 
27
    def do(self, path):
 
28
        from bzrlib.bzrdir import BzrDirFormat
 
29
        t = self._backing_transport.clone(path)
 
30
        default_format = BzrDirFormat.get_default_format()
 
31
        real_bzrdir = default_format.open(t, _found=True)
 
32
        try:
 
33
            real_bzrdir._format.probe_transport(t)
 
34
        except (errors.NotBranchError, errors.UnknownFormatError):
 
35
            answer = 'no'
 
36
        else:
 
37
            answer = 'yes'
 
38
        return SmartServerResponse((answer,))
 
39
 
 
40
 
25
41
class SmartServerRequestFindRepository(SmartServerRequest):
26
42
 
27
43
    def do(self, path):
45
61
            else:
46
62
                segments = []
47
63
            if repository.supports_rich_root():
48
 
                rich_root = 'True'
 
64
                rich_root = 'yes'
49
65
            else:
50
 
                rich_root = 'False'
 
66
                rich_root = 'no'
51
67
            if repository._format.supports_tree_reference:
52
 
                tree_ref = 'True'
 
68
                tree_ref = 'yes'
53
69
            else:
54
 
                tree_ref = 'False'
 
70
                tree_ref = 'no'
55
71
            return SmartServerResponse(('ok', '/'.join(segments), rich_root, tree_ref))
56
72
        except errors.NoRepositoryPresent:
57
73
            return SmartServerResponse(('norepository', ))