# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1270050848 -7200 # Node ID e432b61c6d742a15542744d7f16e62605d93b65e # Parent 737292a3102870d27a953fb291887f5b9e5b0db6 Use Mercurial-provided infrastructure for `svn' metacommand help. diff --git a/hgsubversion/__init__.py b/hgsubversion/__init__.py --- a/hgsubversion/__init__.py +++ b/hgsubversion/__init__.py @@ -144,6 +144,7 @@ def svn(ui, repo, subcommand, *args, **o ui.status('Unknown subcommand %s\n' % subcommand) else: raise +svn.__doc__ = svncommands._helpgen() def reposetup(ui, repo): if repo.local(): @@ -176,7 +177,7 @@ cmdtable = { ('', 'password', '', 'password for authentication'), ('r', 'rev', '', 'Mercurial revision'), ], - svncommands._helpgen(), + 'hg svn ...', ), } diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py --- a/hgsubversion/svncommands.py +++ b/hgsubversion/svncommands.py @@ -2,6 +2,7 @@ import os import posixpath import cPickle as pickle +from mercurial import commands from mercurial import hg from mercurial import node from mercurial import util as hgutil @@ -248,7 +249,7 @@ def help_(ui, args=None, **opts): doc = "No documentation available for %s." % subcommand ui.status(doc.strip(), '\n') return - ui.status(_helpgen()) + commands.help_(ui, 'svn') def update(ui, args, repo, clean=False, **opts): @@ -386,15 +387,14 @@ def listauthors(ui, args, authors=None, def _helpgen(): - ret = ['hg svn ...', '', - 'subcommands for Subversion integration', '', + ret = ['subcommands for Subversion integration', '', 'list of subcommands:', ''] for name, func in sorted(table.items()): if func.__doc__: short_description = func.__doc__.splitlines()[0] else: short_description = '' - ret.append(" %-10s %s" % (name, short_description)) + ret.append(" :%s: %s" % (name, short_description)) return '\n'.join(ret) + '\n'