~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
    def __init__(self, base):
311
311
        super(Transport, self).__init__()
312
312
        self.base = base
 
313
        self._segment_parameters = urlutils.split_segment_parameters(
 
314
            base.rstrip("/"))[1]
313
315
 
314
316
    def _translate_error(self, e, path, raise_generic=True):
315
317
        """Translate an IOError or OSError into an appropriate bzr error.
409
411
        """
410
412
        raise NotImplementedError(self.external_url)
411
413
 
 
414
    def get_segment_parameters(self):
 
415
        """Return the segment parameters for the top segment of the URL.
 
416
        """
 
417
        return self._segment_parameters
 
418
 
412
419
    def _pump(self, from_file, to_file):
413
420
        """Most children will need to copy from one file-like
414
421
        object or string to another one.
1329
1336
            self._parsed_url.quoted_password = (
1330
1337
                _from_transport._parsed_url.quoted_password)
1331
1338
 
1332
 
        base = self._unsplit_url(self._parsed_url.scheme,
1333
 
            self._parsed_url.user, self._parsed_url.password,
1334
 
            self._parsed_url.host, self._parsed_url.port,
1335
 
            self._parsed_url.path)
 
1339
        base = str(self._parsed_url)
1336
1340
 
1337
1341
        super(ConnectedTransport, self).__init__(base)
1338
1342
        if _from_transport is None:
1434
1438
 
1435
1439
        :returns: the Unicode version of the absolute path for relpath.
1436
1440
        """
1437
 
        other = self._parsed_url.clone(relpath)
1438
 
        return self._unsplit_url(other.scheme, other.user, other.password,
1439
 
            other.host, other.port, other.path)
 
1441
        return str(self._parsed_url.clone(relpath))
1440
1442
 
1441
1443
    def _remote_path(self, relpath):
1442
1444
        """Return the absolute path part of the url to the given relative path.