mercurial/extensions.py
branchstable
changeset 11519 bbdf1fb1d3e3
parent 11402 367ce8514da0
child 11520 94b3bbc886cf
equal deleted inserted replaced
11518:8d827f4a23f1 11519:bbdf1fb1d3e3
   102                 if extsetup.func_code.co_argcount != 0:
   102                 if extsetup.func_code.co_argcount != 0:
   103                     raise
   103                     raise
   104                 extsetup() # old extsetup with no ui argument
   104                 extsetup() # old extsetup with no ui argument
   105 
   105 
   106 def wrapcommand(table, command, wrapper):
   106 def wrapcommand(table, command, wrapper):
       
   107     '''Wrap the command named `command' in table
       
   108 
       
   109     Replace command in the command table with wrapper. The wrapped command will
       
   110     be inserted into the command table specified by the table argument.
       
   111 
       
   112     The wrapper will be called like
       
   113 
       
   114       wrapper(orig, *args, **kwargs)
       
   115 
       
   116     where orig is the original (wrapped) function, and *args, **kwargs
       
   117     are the arguments passed to it.
       
   118     '''
   107     aliases, entry = cmdutil.findcmd(command, table)
   119     aliases, entry = cmdutil.findcmd(command, table)
   108     for alias, e in table.iteritems():
   120     for alias, e in table.iteritems():
   109         if e is entry:
   121         if e is entry:
   110             key = alias
   122             key = alias
   111             break
   123             break