mercurial/cmdutil.py
changeset 14297 2daa5179e73f
parent 14291 1a791993ce59
child 14319 b33f3e35efb0
equal deleted inserted replaced
14296:62e25c63fb3a 14297:2daa5179e73f
  1249 
  1249 
  1250     if not text.strip():
  1250     if not text.strip():
  1251         raise util.Abort(_("empty commit message"))
  1251         raise util.Abort(_("empty commit message"))
  1252 
  1252 
  1253     return text
  1253     return text
       
  1254 
       
  1255 def command(table):
       
  1256     '''returns a function object bound to table which can be used as
       
  1257     a decorator for populating table as a command table'''
       
  1258 
       
  1259     def cmd(name, options, synopsis=None):
       
  1260         def decorator(func):
       
  1261             if synopsis:
       
  1262                 table[name] = func, options, synopsis
       
  1263             else:
       
  1264                 table[name] = func, options
       
  1265             return func
       
  1266         return decorator
       
  1267 
       
  1268     return cmd