mercurial/help.py
changeset 27479 3ce1d50daa99
parent 27400 64208bd4c580
child 27631 c18292a6ff54
equal deleted inserted replaced
27478:baa9810ee3ec 27479:3ce1d50daa99
     3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
     3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from i18n import gettext, _
     8 from __future__ import absolute_import
     9 import itertools, os, textwrap
     9 
    10 import error
    10 import itertools
    11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
    11 import os
    12 import templater
    12 import textwrap
    13 import encoding, util, minirst
    13 
    14 import cmdutil
    14 from .i18n import (
    15 import hgweb.webcommands as webcommands
    15     _,
       
    16     gettext,
       
    17 )
       
    18 from . import (
       
    19     cmdutil,
       
    20     encoding,
       
    21     error,
       
    22     extensions,
       
    23     filemerge,
       
    24     fileset,
       
    25     minirst,
       
    26     revset,
       
    27     templatefilters,
       
    28     templatekw,
       
    29     templater,
       
    30     util,
       
    31 )
       
    32 from .hgweb import (
       
    33     webcommands,
       
    34 )
    16 
    35 
    17 _exclkeywords = [
    36 _exclkeywords = [
    18     "(DEPRECATED)",
    37     "(DEPRECATED)",
    19     "(EXPERIMENTAL)",
    38     "(EXPERIMENTAL)",
    20     # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
    39     # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
   109         # Old extensions may use a str as doc.
   128         # Old extensions may use a str as doc.
   110         if (sum(map(lowercontains, names))
   129         if (sum(map(lowercontains, names))
   111             or lowercontains(header)
   130             or lowercontains(header)
   112             or (callable(doc) and lowercontains(doc(ui)))):
   131             or (callable(doc) and lowercontains(doc(ui)))):
   113             results['topics'].append((names[0], header))
   132             results['topics'].append((names[0], header))
   114     import commands # avoid cycle
   133     from . import commands # avoid cycle
   115     for cmd, entry in commands.table.iteritems():
   134     for cmd, entry in commands.table.iteritems():
   116         if len(entry) == 3:
   135         if len(entry) == 3:
   117             summary = entry[2]
   136             summary = entry[2]
   118         else:
   137         else:
   119             summary = ''
   138             summary = ''
   266     '''
   285     '''
   267     Generate the help for 'name' as unformatted restructured text. If
   286     Generate the help for 'name' as unformatted restructured text. If
   268     'name' is None, describe the commands available.
   287     'name' is None, describe the commands available.
   269     '''
   288     '''
   270 
   289 
   271     import commands # avoid cycle
   290     from . import commands # avoid cycle
   272 
   291 
   273     def helpcmd(name, subtopic=None):
   292     def helpcmd(name, subtopic=None):
   274         try:
   293         try:
   275             aliases, entry = cmdutil.findcmd(name, commands.table,
   294             aliases, entry = cmdutil.findcmd(name, commands.table,
   276                                              strict=unknowncmd)
   295                                              strict=unknowncmd)