~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
    def do(self, path):
32
32
        from bzrlib.bzrdir import BzrDirFormat
33
 
        t = self._backing_transport.clone(path)
34
 
        default_format = BzrDirFormat.get_default_format()
35
 
        real_bzrdir = default_format.open(t, _found=True)
36
33
        try:
37
 
            real_bzrdir._format.probe_transport(t)
38
 
        except (errors.NotBranchError, errors.UnknownFormatError):
 
34
            t = self.transport_from_client_path(path)
 
35
        except errors.PathNotChild:
 
36
            # The client is trying to ask about a path that they have no access
 
37
            # to.
 
38
            # Ideally we'd return a FailedSmartServerResponse here rather than
 
39
            # a "successful" negative, but we want to be compatibile with
 
40
            # clients that don't anticipate errors from this method.
39
41
            answer = 'no'
40
42
        else:
41
 
            answer = 'yes'
 
43
            default_format = BzrDirFormat.get_default_format()
 
44
            real_bzrdir = default_format.open(t, _found=True)
 
45
            try:
 
46
                real_bzrdir._format.probe_transport(t)
 
47
            except (errors.NotBranchError, errors.UnknownFormatError):
 
48
                answer = 'no'
 
49
            else:
 
50
                answer = 'yes'
42
51
        return SuccessfulSmartServerResponse((answer,))
43
52
 
44
53
 
61
70
        :raises errors.NoRepositoryPresent: When there is no repository
62
71
            present.
63
72
        """
64
 
        bzrdir = BzrDir.open_from_transport(self._backing_transport.clone(path))
 
73
        bzrdir = BzrDir.open_from_transport(
 
74
            self.transport_from_client_path(path))
65
75
        repository = bzrdir.find_repository()
66
76
        # the relpath of the bzrdir in the found repository gives us the 
67
77
        # path segments to pop-out.
68
 
        relpath = repository.bzrdir.root_transport.relpath(bzrdir.root_transport.base)
 
78
        relpath = repository.bzrdir.root_transport.relpath(
 
79
            bzrdir.root_transport.base)
69
80
        if len(relpath):
70
81
            segments = ['..'] * len(relpath.split('/'))
71
82
        else:
133
144
        The default format of the server is used.
134
145
        :return: SmartServerResponse(('ok', ))
135
146
        """
136
 
        target_transport = self._backing_transport.clone(path)
 
147
        target_transport = self.transport_from_client_path(path)
137
148
        BzrDirFormat.get_default_format().initialize_on_transport(target_transport)
138
149
        return SuccessfulSmartServerResponse(('ok', ))
139
150
 
146
157
        If a bzrdir is not present, an exception is propogated
147
158
        rather than 'no branch' because these are different conditions.
148
159
        """
149
 
        bzrdir = BzrDir.open_from_transport(self._backing_transport.clone(path))
 
160
        bzrdir = BzrDir.open_from_transport(
 
161
            self.transport_from_client_path(path))
150
162
        try:
151
163
            reference_url = bzrdir.get_branch_reference()
152
164
            if reference_url is None: