~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2007-07-20 16:57:41 UTC
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070720165741-a15p58sjtdm8qd6i
Update from review comments.

* bzrlib/tests/blackbox/test_branch.py:
(TestRemoteBranch): New class ensuring that working trees are not
created remotely.

* bzrlib/transport/sftp.py:
(SFTPTransport.__init__): Make from_transport parameter private.

* bzrlib/transport/remote.py:
(RemoteTransport.__init__): Make from_transport parameter private.
(RemoteHTTPTransport.__init__): Make from_transport parameter private.
(RemoteHTTPTransport.clone): Use _from_transport as a keyword
parameter.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib.__init__): Make from_transport parameter private.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport.__init__): Make from_transport parameter private.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase.__init__): Make from_transport parameter private.

* bzrlib/transport/ftp.py:
(FtpTransport.__init__): Make from_transport parameter private.

* bzrlib/transport/__init__.py:
(ConnectedTransport.__init__): Make from_transport parameter private.
(ConnectedTransport.clone, ConnectedTransport._reuse_for): Use
_from_transport as a keyword parameter.

* bzrlib/tests/commands/test_push.py:
(TestPush.test_push): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_pull.py:
(TestPull.test_pull): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_missing.py:
(TestMissing.test_missing): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_merge.py:
(TestMerge.test_merge): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_init_repository.py:
(TestInitRepository.setUp): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_init.py:
(TestInit.setUp): Don't add self.reset_hooks to cleanup, install_hooks
did it.

* bzrlib/tests/commands/test_checkout.py:
(TestCheckout.test_checkout): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/tests/commands/test_cat.py:
(TestCat.test_cat): Don't add self.reset_hooks to cleanup,
install_hooks did it. Skip the test until sftp transport/server problem
is fixed.

* bzrlib/tests/commands/test_branch.py:
(TestBranch.setUp): Don't add self.reset_hooks to cleanup,
install_hooks did it.

* bzrlib/builtins.py:
(_get_bundle_helper): New function. Factored out from merge and pull.
(cmd_pull.run, cmd_merge.run): Use _get_bundle_helper.
(_merge_helper): Add possible_transports as the last parameter.

* bzrlib/tests/transport_util.py: 
Renamed from bzrlib/tests/TransportUtil.py.  Switch from ftp to sftp
transport and server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    Transport,
44
44
    )
45
45
 
46
 
# FIXME: There are two known cases where we open a new connection during the
47
 
# lifetime of the transport:
48
 
# - when an error is received from the server,
49
 
# - when the keep-alive header reach zero.
50
 
# This should be taken into account for the connection sharing by either
51
 
# failing without reconnecting or inform the clones that a new connection have
52
 
# been established.
53
 
 
54
46
# TODO: This is not used anymore by HttpTransport_urllib
55
47
# (extracting the auth info and prompting the user for a password
56
48
# have been split), only the tests still use it. It should be
141
133
    # _unqualified_scheme: "http" or "https"
142
134
    # _scheme: may have "+pycurl", etc
143
135
 
144
 
    def __init__(self, base, from_transport=None):
 
136
    def __init__(self, base, _from_transport=None):
145
137
        """Set the base path where files will be stored."""
146
138
        proto_match = re.match(r'^(https?)(\+\w+)?://', base)
147
139
        if not proto_match:
151
143
        if impl_name:
152
144
            impl_name = impl_name[1:]
153
145
        self._impl_name = impl_name
154
 
        super(HttpTransportBase, self).__init__(base, from_transport)
 
146
        super(HttpTransportBase, self).__init__(base,
 
147
                                                _from_transport=_from_transport)
155
148
        # range hint is handled dynamically throughout the life
156
149
        # of the transport object. We start by trying multi-range
157
150
        # requests and if the server returns bogus results, we
159
152
        # forget about range if the server really can't
160
153
        # understand. Once acquired, this piece of info is
161
154
        # propagated to clones.
162
 
        if from_transport is not None:
163
 
            self._range_hint = from_transport._range_hint
 
155
        if _from_transport is not None:
 
156
            self._range_hint = _from_transport._range_hint
164
157
        else:
165
158
            self._range_hint = 'multi'
166
159