changeset 504:bc117ea4c95a

do not assume that doc-strings are present. A couple of places in the code assumed that docstrings were set. This prevented hgsubversion from loading when Mercurial is run under `python -OO'.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 13 Dec 2009 17:27:19 +0100
parents 00ecb2bc005c
children e508a718779c
files hgsubversion/__init__.py hgsubversion/svncommands.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/__init__.py
+++ b/hgsubversion/__init__.py
@@ -77,7 +77,7 @@ def uisetup(ui):
     docvals = {'extension': 'hgsubversion'}
     for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems():
 
-        if fixdoc:
+        if fixdoc and wrappers.generic.__doc__:
             docvals['command'] = cmd
             docvals['Command'] = cmd.capitalize()
             docvals['target'] = target
--- a/hgsubversion/svncommands.py
+++ b/hgsubversion/svncommands.py
@@ -282,6 +282,9 @@ def _helpgen():
            'subcommands for Subversion integration', '',
            'list of subcommands:', '']
     for name, func in sorted(table.items()):
-        short_description = (func.__doc__ or '').splitlines()[0]
+        if func.__doc__:
+            short_description = func.__doc__.splitlines()[0]
+        else:
+            short_description = ''
         ret.append(" %-10s  %s" % (name, short_description))
     return '\n'.join(ret) + '\n'