mercurial/commands.py
changeset 846 a30f7ee30914
parent 845 52576cf969f2
child 848 221628fe9b62
equal deleted inserted replaced
845:52576cf969f2 846:a30f7ee30914
   284         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
   284         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
   285     )
   285     )
   286 
   286 
   287 def help_(ui, cmd=None):
   287 def help_(ui, cmd=None):
   288     """show help for a given command or all commands"""
   288     """show help for a given command or all commands"""
   289     if cmd:
   289     if cmd and cmd != 'shortlist':
   290         try:
   290         try:
   291             i = find(cmd)
   291             i = find(cmd)
   292             ui.write("%s\n\n" % i[2])
   292             ui.write("%s\n\n" % i[2])
   293 
   293 
   294             if i[1]:
   294             if i[1]:
   327                 if c:
   327                 if c:
   328                     ui.write('    %s\n' % c)
   328                     ui.write('    %s\n' % c)
   329             ui.write("\n")
   329             ui.write("\n")
   330 
   330 
   331             ui.write('hg commands:\n\n')
   331             ui.write('hg commands:\n\n')
   332         else:
   332 
   333             ui.write('basic hg commands (use "hg help -v" for more):\n\n')
   333         if cmd == "shortlist":
       
   334             ui.write('basic hg commands (use "hg help" for more):\n\n')
   334 
   335 
   335         h = {}
   336         h = {}
   336         cmds = {}
   337         cmds = {}
   337         for c, e in table.items():
   338         for c, e in table.items():
   338             f = c.split("|")[0]
   339             f = c.split("|")[0]
   339             if not ui.verbose and not f.startswith("^"):
   340             if cmd == "shortlist" and not f.startswith("^"):
   340                 continue
   341                 continue
   341             if not ui.debugflag and f.startswith("debug"):
   342             if not ui.debugflag and f.startswith("debug"):
   342                 continue
   343                 continue
   343             f = f.lstrip("^")
   344             f = f.lstrip("^")
   344             d = ""
   345             d = ""
  1358         raise ParseError(None, inst)
  1359         raise ParseError(None, inst)
  1359 
  1360 
  1360     if options["version"]:
  1361     if options["version"]:
  1361         return ("version", show_version, [], options, cmdoptions)
  1362         return ("version", show_version, [], options, cmdoptions)
  1362     elif not args:
  1363     elif not args:
  1363         return ("help", help_, [], options, cmdoptions)
  1364         return ("help", help_, ["shortlist"], options, cmdoptions)
  1364     else:
  1365     else:
  1365         cmd, args = args[0], args[1:]
  1366         cmd, args = args[0], args[1:]
  1366 
  1367 
  1367     i = find(cmd)
  1368     i = find(cmd)
  1368 
  1369