mercurial/commands.py
changeset 844 5a717cfa7406
parent 843 859e7ea530bd
child 845 52576cf969f2
equal deleted inserted replaced
843:859e7ea530bd 844:5a717cfa7406
   331             ui.write('hg commands:\n\n')
   331             ui.write('hg commands:\n\n')
   332         else:
   332         else:
   333             ui.write('basic hg commands (use "hg help -v" for more):\n\n')
   333             ui.write('basic hg commands (use "hg help -v" for more):\n\n')
   334 
   334 
   335         h = {}
   335         h = {}
       
   336         cmds = {}
   336         for c, e in table.items():
   337         for c, e in table.items():
   337             f = c.split("|")[0]
   338             f = c.split("|")[0]
   338             if not ui.verbose and not f.startswith("^"):
   339             if not ui.verbose and not f.startswith("^"):
   339                 continue
   340                 continue
   340             if not ui.debugflag and f.startswith("debug"):
   341             if not ui.debugflag and f.startswith("debug"):
   342             f = f.lstrip("^")
   343             f = f.lstrip("^")
   343             d = ""
   344             d = ""
   344             if e[0].__doc__:
   345             if e[0].__doc__:
   345                 d = e[0].__doc__.splitlines(0)[0].rstrip()
   346                 d = e[0].__doc__.splitlines(0)[0].rstrip()
   346             h[f] = d
   347             h[f] = d
       
   348             cmds[f]=c.lstrip("^")
   347 
   349 
   348         fns = h.keys()
   350         fns = h.keys()
   349         fns.sort()
   351         fns.sort()
   350         m = max(map(len, fns))
   352         m = max(map(len, fns))
   351         for f in fns:
   353         for f in fns:
   352             ui.write(' %-*s   %s\n' % (m, f, h[f]))
   354             if ui.verbose:
       
   355                 commands = cmds[f].replace("|",", ")
       
   356                 ui.write(" %s:\n      %s\n"%(commands,h[f]))
       
   357             else:
       
   358                 ui.write(' %-*s   %s\n' % (m, f, h[f]))
   353 
   359 
   354 # Commands start here, listed alphabetically
   360 # Commands start here, listed alphabetically
   355 
   361 
   356 def add(ui, repo, *pats, **opts):
   362 def add(ui, repo, *pats, **opts):
   357     '''add the specified files on the next commit'''
   363     '''add the specified files on the next commit'''