mercurial/cmdutil.py
changeset 21766 a039e1f2326f
parent 21689 503bb3af70fe
child 21767 75a96326cecb
equal deleted inserted replaced
21765:44255f7ce886 21766:a039e1f2326f
  2471     for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
  2471     for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
  2472         if f in copied:
  2472         if f in copied:
  2473             repo.dirstate.copy(copied[f], f)
  2473             repo.dirstate.copy(copied[f], f)
  2474 
  2474 
  2475 def command(table):
  2475 def command(table):
  2476     '''returns a function object bound to table which can be used as
  2476     """Returns a function object to be used as a decorator for making commands.
  2477     a decorator for populating table as a command table'''
  2477 
       
  2478     This function receives a command table as its argument. The table should
       
  2479     be a dict.
       
  2480 
       
  2481     The returned function can be used as a decorator for adding commands
       
  2482     to that command table. This function accepts multiple arguments to define
       
  2483     a command.
       
  2484 
       
  2485     The first argument is the command name.
       
  2486 
       
  2487     The options argument is an iterable of tuples defining command arguments.
       
  2488     See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
       
  2489 
       
  2490     The synopsis argument defines a short, one line summary of how to use the
       
  2491     command. This shows up in the help output.
       
  2492     """
  2478 
  2493 
  2479     def cmd(name, options=(), synopsis=None):
  2494     def cmd(name, options=(), synopsis=None):
  2480         def decorator(func):
  2495         def decorator(func):
  2481             if synopsis:
  2496             if synopsis:
  2482                 table[name] = func, list(options), synopsis
  2497                 table[name] = func, list(options), synopsis