mercurial/commands.py
changeset 16817 946800b43533
parent 16816 d10994f1c7a2
child 16818 d0fc1e689227
equal deleted inserted replaced
16816:d10994f1c7a2 16817:946800b43533
  3266             if name in names:
  3266             if name in names:
  3267                 break
  3267                 break
  3268         else:
  3268         else:
  3269             raise error.UnknownCommand(name)
  3269             raise error.UnknownCommand(name)
  3270 
  3270 
       
  3271         rst = ["%s\n\n" % header]
  3271         # description
  3272         # description
  3272         if not doc:
  3273         if not doc:
  3273             doc = _("(no help text available)")
  3274             rst.append("    %s\n" % _("(no help text available)"))
  3274         if util.safehasattr(doc, '__call__'):
  3275         if util.safehasattr(doc, '__call__'):
  3275             doc = doc()
  3276             rst += ["    %s\n" % l for l in doc().splitlines()]
  3276 
  3277 
  3277         ui.write("%s\n\n" % header)
       
  3278         ui.write(minirst.format(doc, textwidth, indent=4))
       
  3279         try:
  3278         try:
  3280             cmdutil.findcmd(name, table)
  3279             cmdutil.findcmd(name, table)
  3281             ui.write(_('\nuse "hg help -c %s" to see help for '
  3280             rst.append(_('\nuse "hg help -c %s" to see help for '
  3282                        'the %s command\n') % (name, name))
  3281                        'the %s command\n') % (name, name))
  3283         except error.UnknownCommand:
  3282         except error.UnknownCommand:
  3284             pass
  3283             pass
       
  3284         ui.write(minirst.format(''.join(rst), textwidth))
  3285 
  3285 
  3286     def helpext(name):
  3286     def helpext(name):
  3287         try:
  3287         try:
  3288             mod = extensions.find(name)
  3288             mod = extensions.find(name)
  3289             doc = gettext(mod.__doc__) or _('no help text available')
  3289             doc = gettext(mod.__doc__) or _('no help text available')