~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-12-13 17:37:07 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20061213173707-a1gflgoke6b3eboc
First rough http branch redirection implementation.

* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.__init__): Unless told otherwise, redirections are
followed silently.
(HTTPRedirectHandler.http_error_30x): Follow redirection or return
a 30x error.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Raises RedirectRequested if the
request requires it.
(HttpTransport_urllib._get): Update the request from the hints
parameter if needed.

* bzrlib/errors.py:
 (RedirectRequested): New TransportError.

* bzrlib/bzrdir.py:
(BzrDir.open_from_transport): Catch RedirectRequested and retry
with the redirected url until we get to the final destination.
(BzrDirFormat.probe_transport): Hints get to not follow the
redirections but instead tell us where this branch is redirected.

* bzrlib/transport/smart.py:
(SmartTransport.get): Add a 'hint' parameter.

* bzrlib/transport/sftp.py:
(SFTPTransport.get): Add a 'hint' parameter.

* bzrlib/transport/memory.py:
(MemoryTransport.get): Add a 'hint' parameter.

* bzrlib/transport/local.py:
(LocalTransport.get): Add a 'hint' parameter.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._get): Add a 'hint' parameter and pass it to
_get_full.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase.get): Add a 'hint' parameter and pass
it to _get.

* bzrlib/transport/ftp.py:
(FtpTransport.get): Add a 'hint' parameter.

* bzrlib/transport/fakevfat.py:
(FakeVFATTransportDecorator.get): Add a 'hint' parameter and pass
it to the decorated transport.

* bzrlib/transport/decorator.py:
(TransportDecorator.get): Add a 'hint' parameter and pass it to the
decorated transport.

* bzrlib/transport/chroot.py:
(ChrootTransportDecorator.get): Add a 'hint' parameter. Delete a
duplicated definition of the method.

* bzrlib/transport/__init__.py:
(Transport.get): Add a 'hint' parameter.
(TransportLogger.get): Add a 'hint' parameter and pass it to the
        

Show diffs side-by-side

added added

removed removed

Lines of Context:
432
432
                                          "(but must claim to be listable "
433
433
                                          "to trigger this error).")
434
434
 
435
 
    def get(self, relpath):
 
435
    def get(self, relpath, hints={}):
436
436
        """Get the file at the given relative path.
437
437
 
438
438
        :param relpath: The relative path to the file
1148
1148
        self._adapted = adapted
1149
1149
        self._calls = []
1150
1150
 
1151
 
    def get(self, name):
 
1151
    def get(self, name, hints={}):
 
1152
        # There is only one test using the information collected
 
1153
        # below and it asks for the name only. So we do not
 
1154
        # record the hints parameter.
1152
1155
        self._calls.append((name,))
1153
 
        return self._adapted.get(name)
 
1156
        return self._adapted.get(name, hints=hints)
1154
1157
 
1155
1158
    def __getattr__(self, name):
1156
1159
        """Thunk all undefined access through to self._adapted."""