Rev 1746: Merge Goffredo's urlspec help patch and tweak the NEWS entries. in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Mon Apr 23 03:58:35 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 1746
revision-id: robertc at robertcollins.net-20070423025830-2t4rc0lgkysjmigd
parent: robertc at robertcollins.net-20070423022935-9hhongamvk6bfdso
parent: ghigo at venice-20070421124308-icnfzoxvh2uar6ef
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Mon 2007-04-23 12:58:30 +1000
message:
  Merge Goffredo's urlspec help patch and tweak the NEWS entries.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/blackbox/test_help.py test_help.py-20060216004358-4ee8a2a338f75a62
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
    ------------------------------------------------------------
    revno: 1739.1.502.2.13
    merged: ghigo at venice-20070421124308-icnfzoxvh2uar6ef
    parent: ghigo at venice-20070421122215-glii923x3cfwo02j
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Sat 2007-04-21 14:43:08 +0200
    message:
      NEWS file updated
    ------------------------------------------------------------
    revno: 1739.1.502.2.12
    merged: ghigo at venice-20070421122215-glii923x3cfwo02j
    parent: ghigo at venice-20070207210804-r551d0lozrp20uex
    parent: ghigo at venice-20070421110123-cc9axlewjexbmn63
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Sat 2007-04-21 14:22:15 +0200
    message:
      update to the latest bzr.dev
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.6
        merged: ghigo at venice-20070421110123-cc9axlewjexbmn63
        parent: ghigo at venice-20070329204446-2j3uumjq9faxsigz
        parent: pqm at pqm.ubuntu.com-20070420154033-kkrk7tn575z1o491
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Sat 2007-04-21 13:01:23 +0200
        message:
          Upgraded to the latest bzr.dev
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.5
        merged: ghigo at venice-20070329204446-2j3uumjq9faxsigz
        parent: ghigo at venice-20070207205057-hveyr0yfn35dhhea
        parent: pqm at pqm.ubuntu.com-20070329191009-2b533e883212576c
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Thu 2007-03-29 22:44:46 +0200
        message:
          update to the latest bzr.dev
    ------------------------------------------------------------
    revno: 1739.1.502.2.11
    merged: ghigo at venice-20070207210804-r551d0lozrp20uex
    parent: ghigo at venice-20070207205220-5tnjou7hz9722njy
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Wed 2007-02-07 22:08:04 +0100
    message:
      On the basis of Robert Collins and John Arbash Meinel
      - removed some protocol ( http[s]+pycurl:// and http[s]+urllib://, 
      bzr+http:// and readonly+ )
      - _help_on_trasport( ) now supports the missing of the modifiers
      - add a blackbox test case
      - little PEP8 cleanup
    ------------------------------------------------------------
    revno: 1739.1.502.2.10
    merged: ghigo at venice-20070207205220-5tnjou7hz9722njy
    parent: ghigo at venice-20070127175620-t4gyjzfy3hd2m59c
    parent: ghigo at venice-20070207205057-hveyr0yfn35dhhea
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Wed 2007-02-07 21:52:20 +0100
    message:
      Update to the latest bzr-transport-registry
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.4
        merged: ghigo at venice-20070207205057-hveyr0yfn35dhhea
        parent: ghigo at venice-20070207203349-gc7actj3vso0haf2
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Wed 2007-02-07 21:50:57 +0100
        message:
          Updates on the basis of John Arbash Meinel comments
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.3
        merged: ghigo at venice-20070207203349-gc7actj3vso0haf2
        parent: ghigo at venice-20070127172542-ejnyjb4mlxpgrhcd
        parent: pqm at pqm.ubuntu.com-20070207142350-d0b5e937ce139c73
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Wed 2007-02-07 21:33:49 +0100
        message:
          update to the latest bzr.dev
    ------------------------------------------------------------
    revno: 1739.1.502.2.9
    merged: ghigo at venice-20070127175620-t4gyjzfy3hd2m59c
    parent: ghigo at venice-20070127175044-wpibgqm8wtpvmqe6
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Sat 2007-01-27 18:56:20 +0100
    message:
      add the 'file://' prefix to the urlspec topic
    ------------------------------------------------------------
    revno: 1739.1.502.2.8
    merged: ghigo at venice-20070127175044-wpibgqm8wtpvmqe6
    parent: ghigo at venice-20070127172631-etl6aa78zxak9t0e
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Sat 2007-01-27 18:50:44 +0100
    message:
      - rename transport urlspec
      - sort the transport without '://'
    ------------------------------------------------------------
    revno: 1739.1.502.2.7
    merged: ghigo at venice-20070127172631-etl6aa78zxak9t0e
    parent: ghigo at venice-20070126211058-rekclacctmf9tes8
    parent: ghigo at venice-20070127172542-ejnyjb4mlxpgrhcd
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Sat 2007-01-27 18:26:31 +0100
    message:
      update to the latest bzr-transport-registry branch
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.2
        merged: ghigo at venice-20070127172542-ejnyjb4mlxpgrhcd
        parent: ghigo at venice-20070127172441-cdb1cz664f9jqent
        parent: pqm at pqm.ubuntu.com-20070125194626-4ded330415b7276d
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Sat 2007-01-27 18:25:42 +0100
        message:
          update to the latest bzr.dev
        ------------------------------------------------------------
        revno: 1739.1.502.2.4.1.1
        merged: ghigo at venice-20070127172441-cdb1cz664f9jqent
        parent: ghigo at venice-20070126204417-p0o5hyx1d2s7qcmm
        committer: ghigo <ghigo at venice>
        branch nick: bzr-transport-registry
        timestamp: Sat 2007-01-27 18:24:41 +0100
        message:
          uncomment test test__get_set_protocol_handlers
    ------------------------------------------------------------
    revno: 1739.1.502.2.6
    merged: ghigo at venice-20070126211058-rekclacctmf9tes8
    parent: ghigo at venice-20070126210953-2meopm4tu1x728wx
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Fri 2007-01-26 22:10:58 +0100
    message:
      removed unused code
    ------------------------------------------------------------
    revno: 1739.1.502.2.5
    merged: ghigo at venice-20070126210953-2meopm4tu1x728wx
    parent: ghigo at venice-20070126204417-p0o5hyx1d2s7qcmm
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry-help-topics
    timestamp: Fri 2007-01-26 22:09:53 +0100
    message:
      add the topics transport
    ------------------------------------------------------------
    revno: 1739.1.502.2.4
    merged: ghigo at venice-20070126204417-p0o5hyx1d2s7qcmm
    parent: ghigo at venice-20070126204127-lnwfza86czjj5t9u
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry
    timestamp: Fri 2007-01-26 21:44:17 +0100
    message:
      removed commented line
    ------------------------------------------------------------
    revno: 1739.1.502.2.3
    merged: ghigo at venice-20070126204127-lnwfza86czjj5t9u
    parent: ghigo at venice-20070126203011-lhslhnwj1avh0jee
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry
    timestamp: Fri 2007-01-26 21:41:27 +0100
    message:
      removed the the registration of the 'None' transport, instead we use the set_default_transport function
      rename transport_registry in transport_list_registry
      remove unused function
    ------------------------------------------------------------
    revno: 1739.1.502.2.2
    merged: ghigo at venice-20070126203011-lhslhnwj1avh0jee
    parent: ghigo at venice-20070124203508-4tg2vz734s5j40y7
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry
    timestamp: Fri 2007-01-26 21:30:11 +0100
    message:
      Create the TransportList class
    ------------------------------------------------------------
    revno: 1739.1.502.2.1
    merged: ghigo at venice-20070124203508-4tg2vz734s5j40y7
    parent: pqm at pqm.ubuntu.com-20070120020104-a192555a9165b259
    committer: ghigo <ghigo at venice>
    branch nick: bzr-transport-registry
    timestamp: Wed 2007-01-24 21:35:08 +0100
    message:
      Add the TransportRegistry class
=== modified file 'NEWS'
--- a/NEWS	2007-04-23 00:28:58 +0000
+++ b/NEWS	2007-04-23 02:58:30 +0000
@@ -36,6 +36,9 @@
     * ``bzr help PLUGINNAME`` will now return the module docstring from the
       plugin PLUGINNAME fixing bug 50408. (Robert Collins)
 
+    * New help topic ``urlspec`` which lists the availables transports.
+      (Goffredo Baroncelli)
+
   INTERNALS:
 
     * bzrlib API compatability with 0.8 has been dropped, cleaning up some
@@ -102,6 +105,9 @@
     * ``bzrlib.help`` now delegates to the Command class for Command specific
       help. (Robert Collins)
 
+    * New class 'TransportListRegistry', derived from the Registry class, which 
+      simplifies tracking the available Transports. (Goffredo Baroncelli)
+
   BUGFIXES:
 
     * Don't fail bundle selftest if email has 'two' embedded.  

=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-04-20 05:36:58 +0000
+++ b/bzrlib/help_topics.py	2007-04-23 02:58:30 +0000
@@ -100,6 +100,53 @@
     return ''.join(out)
 
 
+def _help_on_transport(name):
+    from bzrlib.transport import (
+        transport_list_registry,
+    )
+    import textwrap
+
+    def add_string(proto, help, maxl, prefix_width=20):
+       help_lines = textwrap.wrap(help, maxl - prefix_width)
+       line_with_indent = '\n' + ' ' * prefix_width
+       help_text = line_with_indent.join(help_lines)
+       return "%-20s%s\n" % (proto, help_text)
+
+    def sort_func(a,b):
+        a1 = a[:a.rfind("://")]
+        b1 = b[:b.rfind("://")]
+        if a1>b1:
+            return +1
+        elif a1<b1:
+            return -1
+        else:
+            return 0
+
+    out = []
+    protl = []
+    decl = []
+    protos = transport_list_registry.keys( )
+    protos.sort(sort_func)
+    for proto in protos:
+        shorthelp = transport_list_registry.get_help(proto)
+        if not shorthelp:
+            continue
+        if proto.endswith("://"):
+            protl.extend(add_string(proto, shorthelp, 79))
+        else:
+            decl.extend(add_string(proto, shorthelp, 79))
+
+
+    out = "\nSupported URL prefix\n--------------------\n" + \
+            ''.join(protl)
+
+    if len(decl):
+        out += "\nSupported modifiers\n-------------------\n" + \
+            ''.join(decl)
+
+    return out
+
+
 _basic_help= \
 """Bazaar -- a free distributed version-control tool
 http://bazaar-vcs.org/
@@ -242,6 +289,8 @@
                         'Options that can be used with any command')
 topic_registry.register('checkouts', _checkouts,
                         'Information on what a checkout is')
+topic_registry.register('urlspec', _help_on_transport,
+                        "Supported transport protocols")
 
 
 class HelpTopicIndex(object):

=== modified file 'bzrlib/tests/blackbox/test_help.py'
--- a/bzrlib/tests/blackbox/test_help.py	2007-04-19 04:54:08 +0000
+++ b/bzrlib/tests/blackbox/test_help.py	2007-04-21 12:22:15 +0000
@@ -56,6 +56,18 @@
         out, err = self.runbzr('help checkouts')
         self.assertContainsRe(out, 'checkout')
         self.assertContainsRe(out, 'lightweight')
+        
+    def test_help_urlspec(self):
+        """Smoke test for 'bzr help urlspec'"""
+        out, err = self.run_bzr('help', 'urlspec')
+        self.assertContainsRe(out, 'aftp://')
+        self.assertContainsRe(out, 'bzr://')
+        self.assertContainsRe(out, 'bzr\+ssh://')
+        self.assertContainsRe(out, 'file://')
+        self.assertContainsRe(out, 'ftp://')
+        self.assertContainsRe(out, 'http://')
+        self.assertContainsRe(out, 'https://')
+        self.assertContainsRe(out, 'sftp://')
 
     def test_help_commands(self):
         dash_help  = self.runbzr('--help commands')[0]

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2007-04-05 09:35:26 +0000
+++ b/bzrlib/tests/test_transport.py	2007-04-21 11:01:23 +0000
@@ -34,11 +34,12 @@
 from bzrlib.tests import TestCase, TestCaseInTempDir
 from bzrlib.transport import (_CoalescedOffset,
                               _get_protocol_handlers,
+                              _set_protocol_handlers,
                               _get_transport_modules,
                               get_transport,
-                              _protocol_handlers,
                               register_lazy_transport,
-                              _set_protocol_handlers,
+                              register_transport_proto,
+                              _clear_protocol_handlers,
                               Transport,
                               )
 from bzrlib.transport.chroot import ChrootServer
@@ -55,10 +56,10 @@
 
     def test__get_set_protocol_handlers(self):
         handlers = _get_protocol_handlers()
-        self.assertNotEqual({}, handlers)
+        self.assertNotEqual([], handlers.keys( ))
         try:
-            _set_protocol_handlers({})
-            self.assertEqual({}, _get_protocol_handlers())
+            _clear_protocol_handlers()
+            self.assertEqual([], _get_protocol_handlers().keys())
         finally:
             _set_protocol_handlers(handlers)
 
@@ -67,9 +68,10 @@
         class SampleHandler(object):
             """I exist, isnt that enough?"""
         try:
-            my_handlers = {}
-            _set_protocol_handlers(my_handlers)
+            _clear_protocol_handlers()
+            register_transport_proto('foo')
             register_lazy_transport('foo', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
+            register_transport_proto('bar')
             register_lazy_transport('bar', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
             self.assertEqual([SampleHandler.__module__, 'bzrlib.transport.chroot'],
                              _get_transport_modules())
@@ -80,6 +82,7 @@
         """Transport with missing dependency causes no error"""
         saved_handlers = _get_protocol_handlers()
         try:
+            register_transport_proto('foo')
             register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                     'BadTransportHandler')
             try:
@@ -100,7 +103,8 @@
         """Transport with missing dependency causes no error"""
         saved_handlers = _get_protocol_handlers()
         try:
-            _set_protocol_handlers({})
+            _clear_protocol_handlers()
+            register_transport_proto('foo')
             register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                     'BackupTransportHandler')
             register_lazy_transport('foo', 'bzrlib.tests.test_transport',
@@ -361,14 +365,14 @@
         backing_transport = MemoryTransport()
         server = ChrootServer(backing_transport)
         server.setUp()
-        self.assertTrue(server.scheme in _protocol_handlers.keys())
+        self.assertTrue(server.scheme in _get_protocol_handlers().keys())
 
     def test_tearDown(self):
         backing_transport = MemoryTransport()
         server = ChrootServer(backing_transport)
         server.setUp()
         server.tearDown()
-        self.assertFalse(server.scheme in _protocol_handlers.keys())
+        self.assertFalse(server.scheme in _get_protocol_handlers().keys())
 
     def test_get_url(self):
         backing_transport = MemoryTransport()

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2007-04-20 08:33:47 +0000
+++ b/bzrlib/transport/__init__.py	2007-04-21 12:22:15 +0000
@@ -63,64 +63,12 @@
     mutter,
     warning,
     )
-
-# {prefix: [transport_classes]}
-# Transports are inserted onto the list LIFO and tried in order; as a result
-# transports provided by plugins are tried first, which is usually what we
-# want.
-_protocol_handlers = {
-}
-
-def register_transport(prefix, klass, override=DEPRECATED_PARAMETER):
-    """Register a transport that can be used to open URLs
-
-    Normally you should use register_lazy_transport, which defers loading the
-    implementation until it's actually used, and so avoids pulling in possibly
-    large implementation libraries.
-    """
-    # Note that this code runs very early in library setup -- trace may not be
-    # working, etc.
-    global _protocol_handlers
-    if deprecated_passed(override):
-        warnings.warn("register_transport(override) is deprecated")
-    _protocol_handlers.setdefault(prefix, []).insert(0, klass)
-
-
-def register_lazy_transport(scheme, module, classname):
-    """Register lazy-loaded transport class.
-
-    When opening a URL with the given scheme, load the module and then
-    instantiate the particular class.  
-
-    If the module raises DependencyNotPresent when it's imported, it is
-    skipped and another implementation of the protocol is tried.  This is
-    intended to be used when the implementation depends on an external
-    implementation that may not be present.  If any other error is raised, it
-    propagates up and the attempt to open the url fails.
-
-    :param scheme: The url scheme part, eg "ftp://"
-    """
-    # TODO: If no implementation of a protocol is available because of missing
-    # dependencies, we should perhaps show the message about what dependency
-    # was missing.
-    def _loader(base):
-        mod = __import__(module, globals(), locals(), [classname])
-        klass = getattr(mod, classname)
-        return klass(base)
-    _loader.module = module
-    register_transport(scheme, _loader)
-
-
-def unregister_transport(scheme, factory):
-    """Unregister a transport."""
-    _protocol_handlers[scheme].remove(factory)
-    if _protocol_handlers[scheme] == []:
-        del _protocol_handlers[scheme]
+from bzrlib import registry
 
 
 def _get_protocol_handlers():
     """Return a dictionary of {urlprefix: [factory]}"""
-    return _protocol_handlers
+    return transport_list_registry
 
 
 def _set_protocol_handlers(new_handlers):
@@ -128,26 +76,24 @@
 
     WARNING this will remove all build in protocols. Use with care.
     """
-    global _protocol_handlers
-    _protocol_handlers = new_handlers
+    global transport_list_registry
+    transport_list_registry = new_handlers
 
 
 def _clear_protocol_handlers():
-    global _protocol_handlers
-    _protocol_handlers = {}
+    global transport_list_registry
+    transport_list_registry = TransportListRegistry()
 
 
 def _get_transport_modules():
     """Return a list of the modules providing transports."""
     modules = set()
-    for prefix, factory_list in _protocol_handlers.items():
+    for prefix, factory_list in transport_list_registry.iteritems():
         for factory in factory_list:
-            if factory.__module__ == "bzrlib.transport":
-                # this is a lazy load transport, because no real ones
-                # are directly in bzrlib.transport
-                modules.add(factory.module)
+            if hasattr(factory, "_module_name"):
+                modules.add(factory._module_name)
             else:
-                modules.add(factory.__module__)
+                modules.add(factory._obj.__module__)
     # Add chroot directly, because there is not handler registered for it.
     modules.add('bzrlib.transport.chroot')
     result = list(modules)
@@ -155,12 +101,74 @@
     return result
 
 
+class TransportListRegistry(registry.Registry):
+    """A registry which simplifies tracking available Transports.
+
+    A registration of a new protocol requires two step:
+    1) register the prefix with the function register_transport( )
+    2) register the protocol provider with the function
+    register_transport_provider( ) ( and the "lazy" variant )
+
+    This in needed because:
+    a) a single provider can support multple protcol ( like the ftp
+    privider which supports both the ftp:// and the aftp:// protocols )
+    b) a single protocol can have multiple providers ( like the http://
+    protocol which is supported by both the urllib and pycurl privider )
+    """
+
+    def register_transport_provider(self, key, obj):
+        self.get(key).insert(0, registry._ObjectGetter(obj))
+
+    def register_lazy_transport_provider(self, key, module_name, member_name):
+        self.get(key).insert(0, 
+                registry._LazyObjectGetter(module_name, member_name))
+
+    def register_transport(self, key, help=None, info=None):
+        self.register(key, [], help, info)
+
+    def set_default_transport(self, key=None):
+        """Return either 'key' or the default key if key is None"""
+        self._default_key = key
+
+
+transport_list_registry = TransportListRegistry( )
+
+
+def register_transport_proto(prefix, help=None, info=None):
+    transport_list_registry.register_transport(prefix, help, info)
+
+
+def register_lazy_transport(prefix, module, classname):
+    if not prefix in transport_list_registry:
+        register_transport_proto(prefix)
+    transport_list_registry.register_lazy_transport_provider(prefix, module, classname)
+
+
+def register_transport(prefix, klass, override=DEPRECATED_PARAMETER):
+    if not prefix in transport_list_registry:
+        register_transport_proto(prefix)
+    transport_list_registry.register_transport_provider(prefix, klass)
+
+
 def register_urlparse_netloc_protocol(protocol):
     """Ensure that protocol is setup to be used with urlparse netloc parsing."""
     if protocol not in urlparse.uses_netloc:
         urlparse.uses_netloc.append(protocol)
 
 
+def unregister_transport(scheme, factory):
+    """Unregister a transport."""
+    l = transport_list_registry.get(scheme)
+    for i in l:
+        o = i.get_obj( )
+        if o == factory:
+            transport_list_registry.get(scheme).remove(i)
+            break
+    if len(l) == 0:
+        transport_list_registry.remove(scheme)
+
+
+
 def split_url(url):
     # TODO: jam 20060606 urls should only be ascii, or they should raise InvalidURL
     if isinstance(url, unicode):
@@ -405,6 +413,7 @@
         """
         raise errors.NotLocalUrl(self.abspath(relpath))
 
+
     def has(self, relpath):
         """Does the file relpath exist?
         
@@ -1019,7 +1028,7 @@
 
     base is either a URL or a directory name.  
     """
-    global _protocol_handlers
+
     if base is None:
         base = '.'
     last_err = None
@@ -1043,7 +1052,7 @@
         base = convert_path_to_url(base,
             'URLs must be properly escaped (protocol: %s)')
     
-    for proto, factory_list in _protocol_handlers.iteritems():
+    for proto, factory_list in transport_list_registry.iteritems():
         if proto is not None and base.startswith(proto):
             t, last_err = _try_transport_factories(base, factory_list)
             if t:
@@ -1054,9 +1063,9 @@
     base = convert_path_to_url(base, 'Unsupported protocol: %s')
 
     # The default handler is the filesystem handler, stored as protocol None
-    return _try_transport_factories(base, _protocol_handlers[None])[0]
-
-
+    return _try_transport_factories(base,
+                    transport_list_registry.get(None))[0]
+                                                   
 def do_catching_redirections(action, transport, redirected):
     """Execute an action with given transport catching redirections.
 
@@ -1103,7 +1112,7 @@
     last_err = None
     for factory in factory_list:
         try:
-            return factory(base), None
+            return factory.get_obj()(base), None
         except errors.DependencyNotPresent, e:
             mutter("failed to instantiate transport %r for %r: %r" %
                     (factory, base, e))
@@ -1218,42 +1227,85 @@
     def readv(self, name, offsets):
         self._calls.append((name, offsets))
         return self._adapted.readv(name, offsets)
-        
+
 
 # None is the default transport, for things with no url scheme
-register_lazy_transport(None, 'bzrlib.transport.local', 'LocalTransport')
+register_transport_proto('file://',
+            help="Access using the standard filesystem (default)")
 register_lazy_transport('file://', 'bzrlib.transport.local', 'LocalTransport')
+transport_list_registry.set_default_transport("file://")
+
+register_transport_proto('sftp://',
+            help="Access using SFTP (most SSH servers provide SFTP).")
 register_lazy_transport('sftp://', 'bzrlib.transport.sftp', 'SFTPTransport')
 # Decorated http transport
+register_transport_proto('http+urllib://',
+#                help="Read-only access of branches exported on the web."
+            )
 register_lazy_transport('http+urllib://', 'bzrlib.transport.http._urllib',
                         'HttpTransport_urllib')
+register_transport_proto('https+urllib://',
+#                help="Read-only access of branches exported on the web using SSL."
+            )
 register_lazy_transport('https+urllib://', 'bzrlib.transport.http._urllib',
                         'HttpTransport_urllib')
+register_transport_proto('http+pycurl://',
+#                help="Read-only access of branches exported on the web."
+            )
 register_lazy_transport('http+pycurl://', 'bzrlib.transport.http._pycurl',
                         'PyCurlTransport')
+register_transport_proto('https+pycurl://',
+#                help="Read-only access of branches exported on the web using SSL."
+            )
 register_lazy_transport('https+pycurl://', 'bzrlib.transport.http._pycurl',
                         'PyCurlTransport')
 # Default http transports (last declared wins (if it can be imported))
+register_transport_proto('http://',
+            help="Read-only access of branches exported on the web.")
+register_transport_proto('https://',
+            help="Read-only access of branches exported on the web using SSL.")
 register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
                         'HttpTransport_urllib')
 register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
                         'HttpTransport_urllib')
 register_lazy_transport('http://', 'bzrlib.transport.http._pycurl', 'PyCurlTransport')
 register_lazy_transport('https://', 'bzrlib.transport.http._pycurl', 'PyCurlTransport')
+
+register_transport_proto('ftp://',
+            help="Access using passive FTP.")
 register_lazy_transport('ftp://', 'bzrlib.transport.ftp', 'FtpTransport')
+register_transport_proto('aftp://',
+            help="Access using active FTP.")
 register_lazy_transport('aftp://', 'bzrlib.transport.ftp', 'FtpTransport')
+
+register_transport_proto('memory://')
 register_lazy_transport('memory://', 'bzrlib.transport.memory', 'MemoryTransport')
+register_transport_proto('chroot+')
+
+register_transport_proto('readonly+',
+#              help="This modifier converts any transport to be readonly."
+            )
 register_lazy_transport('readonly+', 'bzrlib.transport.readonly', 'ReadonlyTransportDecorator')
+register_transport_proto('fakenfs+')
 register_lazy_transport('fakenfs+', 'bzrlib.transport.fakenfs', 'FakeNFSTransportDecorator')
+register_transport_proto('vfat+')
 register_lazy_transport('vfat+',
                         'bzrlib.transport.fakevfat',
                         'FakeVFATTransportDecorator')
+register_transport_proto('bzr://',
+            help="Fast access using the Bazaar smart server.")
+
 register_lazy_transport('bzr://',
                         'bzrlib.transport.remote',
                         'RemoteTCPTransport')
+register_transport_proto('bzr+http://',
+#                help="Fast access using the Bazaar smart server over HTTP."
+             )
 register_lazy_transport('bzr+http://',
                         'bzrlib.transport.remote',
                         'RemoteHTTPTransport')
+register_transport_proto('bzr+ssh://',
+            help="Fast access using the Bazaar smart server over SSH.")
 register_lazy_transport('bzr+ssh://',
                         'bzrlib.transport.remote',
                         'RemoteSSHTransport')



More information about the bazaar-commits mailing list