mercurial/help.py
changeset 46261 c9b2a4d69e66
parent 45942 89a2afe31e82
child 46386 d481f30ea8e3
equal deleted inserted replaced
46260:abba2d365373 46261:c9b2a4d69e66
  1062                 rst.extend(minirst.maketable(sorted(matches[t]), 1))
  1062                 rst.extend(minirst.maketable(sorted(matches[t]), 1))
  1063                 rst.append(b'\n')
  1063                 rst.append(b'\n')
  1064         if not rst:
  1064         if not rst:
  1065             msg = _(b'no matches')
  1065             msg = _(b'no matches')
  1066             hint = _(b"try 'hg help' for a list of topics")
  1066             hint = _(b"try 'hg help' for a list of topics")
  1067             raise error.Abort(msg, hint=hint)
  1067             raise error.InputError(msg, hint=hint)
  1068     elif name and name != b'shortlist':
  1068     elif name and name != b'shortlist':
  1069         queries = []
  1069         queries = []
  1070         if unknowncmd:
  1070         if unknowncmd:
  1071             queries += [helpextcmd]
  1071             queries += [helpextcmd]
  1072         if opts.get(b'extension'):
  1072         if opts.get(b'extension'):
  1093                     hintname = subtopic
  1093                     hintname = subtopic
  1094                 else:
  1094                 else:
  1095                     hintname = name
  1095                     hintname = name
  1096                 msg = _(b'no such help topic: %s') % formatname
  1096                 msg = _(b'no such help topic: %s') % formatname
  1097                 hint = _(b"try 'hg help --keyword %s'") % hintname
  1097                 hint = _(b"try 'hg help --keyword %s'") % hintname
  1098                 raise error.Abort(msg, hint=hint)
  1098                 raise error.InputError(msg, hint=hint)
  1099     else:
  1099     else:
  1100         # program name
  1100         # program name
  1101         if not ui.quiet:
  1101         if not ui.quiet:
  1102             rst = [_(b"Mercurial Distributed SCM\n"), b'\n']
  1102             rst = [_(b"Mercurial Distributed SCM\n"), b'\n']
  1103         rst.extend(helplist(None, **pycompat.strkwargs(opts)))
  1103         rst.extend(helplist(None, **pycompat.strkwargs(opts)))
  1153 
  1153 
  1154     # We could have been given a weird ".foo" section without a name
  1154     # We could have been given a weird ".foo" section without a name
  1155     # to look for, or we could have simply failed to found "foo.bar"
  1155     # to look for, or we could have simply failed to found "foo.bar"
  1156     # because bar isn't a section of foo
  1156     # because bar isn't a section of foo
  1157     if section and not (blocks and name):
  1157     if section and not (blocks and name):
  1158         raise error.Abort(_(b"help section not found: %s") % fullname)
  1158         raise error.InputError(_(b"help section not found: %s") % fullname)
  1159 
  1159 
  1160     return minirst.formatplain(blocks, textwidth)
  1160     return minirst.formatplain(blocks, textwidth)