/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Andrew Bennetts
  • Date: 2009-09-21 09:10:15 UTC
  • mto: This revision was merged to the branch mainline in revision 4713.
  • Revision ID: andrew.bennetts@canonical.com-20090921091015-637veymgnv52q7pk
Add tests, and fix BzrDirMeta1.has_workingtree which was failing if the local transport is decorated with a ChrootTransport or similar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
class RemoteBzrDir(BzrDir, _RpcHelper):
90
90
    """Control directory on a remote server, accessed via bzr:// or similar."""
91
91
 
92
 
    def __init__(self, transport, format, _client=None):
 
92
    def __init__(self, transport, format, _client=None, _force_probe=False):
93
93
        """Construct a RemoteBzrDir.
94
94
 
95
95
        :param _client: Private parameter for testing. Disables probing and the
109
109
            self._client = client._SmartClient(medium)
110
110
        else:
111
111
            self._client = _client
112
 
            return
113
 
 
 
112
            if not _force_probe:
 
113
                return
 
114
 
 
115
        self._probe_bzrdir()
 
116
 
 
117
    def _probe_bzrdir(self):
 
118
        medium = self._client._medium
114
119
        path = self._path_for_remote_call(self._client)
115
120
        if medium._is_remote_before((2, 1)):
116
121
            self._rpc_open(path)
381
386
        else:
382
387
            raise errors.NoRepositoryPresent(self)
383
388
 
384
 
    def open_workingtree(self, recommend_upgrade=True):
 
389
    def has_workingtree(self):
385
390
        if self._has_working_tree is None:
386
391
            self._ensure_real()
387
392
            self._has_working_tree = self._real_bzrdir.has_workingtree()
388
 
        if self._has_working_tree:
 
393
        return self._has_working_tree
 
394
 
 
395
    def open_workingtree(self, recommend_upgrade=True):
 
396
        if self.has_workingtree():
389
397
            raise errors.NotLocalUrl(self.root_transport)
390
398
        else:
391
399
            raise errors.NoWorkingTree(self.root_transport.base)