Rev 2236: merge and update ghigo's transport help in file:///home/mbp/bzr/Work/help/

Martin Pool mbp at sourcefrog.net
Wed Jan 17 03:14:47 GMT 2007


------------------------------------------------------------
revno: 2236
revision-id: mbp at sourcefrog.net-20070117031445-x64ihshiqowvagai
parent: pqm at pqm.ubuntu.com-20070116170721-bbe931a8978b7ce9
parent: ghigo at venice-20061106210031-6a014c0e60d81304
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: help
timestamp: Wed 2007-01-17 14:14:45 +1100
message:
  merge and update ghigo's transport help
modified:
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
    ------------------------------------------------------------
    revno: 2023.1.2.1.2
    merged: ghigo at venice-20061106210031-6a014c0e60d81304
    parent: ghigo at venice-20061106205911-9ca833314c380328
    parent: ghigo at venice-20061106200643-fbb177de22f12ebb
    committer: ghigo <ghigo at venice>
    branch nick: bzr-help-topics-transport
    timestamp: Mon 2006-11-06 22:00:31 +0100
    message:
      update to the latest bzr-help-topic branch
    ------------------------------------------------------------
    revno: 2023.1.2.1.1
    merged: ghigo at venice-20061106205911-9ca833314c380328
    parent: ghigo at venice-20060920210038-6f46e04ee2de73d6
    committer: ghigo <ghigo at venice>
    branch nick: bzr-help-topics-transport
    timestamp: Mon 2006-11-06 21:59:11 +0100
    message:
      add transport topic
=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-01-10 06:01:49 +0000
+++ b/bzrlib/help_topics.py	2007-01-17 03:14:45 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006, 2007 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -100,6 +100,46 @@
     return ''.join(out)
 
 
+def _help_on_transports(name):
+    from bzrlib.transport import (
+        _protocol_handlers,
+    )
+    o = []
+    o.append("\nSupported transport protocols:\n--------------------------\n")
+    transport_dict={}
+    for proto, factory_list in _protocol_handlers.iteritems():
+        if proto and len(proto) > 2 and proto[-2:] <> "//": continue
+        for f in factory_list:
+            if f.__module__ == "bzrlib.transport":
+                # this is a lazy load transport, because no real ones
+                # are directlry in bzrlib.transport
+                mod = __import__(f.module, globals(), locals(), [f.classname])
+                klass = getattr(mod, f.classname)
+            else:
+                klass = f.__module__
+
+            doc = klass.__doc__
+            if doc in transport_dict:
+                l = transport_dict[doc]
+                l.append(proto)
+            else:
+                transport_dict[doc] = [proto]
+
+    for doc in transport_dict:
+        protos = transport_dict[doc]
+        o.append("  Transport: ");
+        first = True
+        for proto in protos:
+            if not proto:
+                proto="<default>"
+            if not first:
+                o.append(", ")
+            o.append("%s"%proto)
+            first = False
+        o.append("\n    %s\n\n"%doc)
+    return ''.join(o)
+
+
 _basic_help= \
 """Bazaar -- a free distributed version-control tool
 http://bazaar-vcs.org/
@@ -135,3 +175,5 @@
     from bzrlib import bzrdir
     return bzrdir.format_registry.help_topic(topic)
 topic_registry.register('formats', get_format_topic, 'Directory formats')
+topic_registry.register("protocols", _help_on_transports, 
+    "Supported transport protocols")

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2006-12-15 23:34:42 +0000
+++ b/bzrlib/transport/__init__.py	2007-01-17 03:14:45 +0000
@@ -102,6 +102,7 @@
         klass = getattr(mod, classname)
         return klass(base)
     _loader.module = module
+    _loader.classname = classname
     register_transport(scheme, _loader)
 
 




More information about the bazaar-commits mailing list