--- a/mercurial/cmdutil.py Thu May 12 13:47:17 2011 +0200
+++ b/mercurial/cmdutil.py Thu May 12 08:14:04 2011 +0200
@@ -1251,3 +1251,18 @@
raise util.Abort(_("empty commit message"))
return text
+
+def command(table):
+ '''returns a function object bound to table which can be used as
+ a decorator for populating table as a command table'''
+
+ def cmd(name, options, synopsis=None):
+ def decorator(func):
+ if synopsis:
+ table[name] = func, options, synopsis
+ else:
+ table[name] = func, options
+ return func
+ return decorator
+
+ return cmd