diff hgext/record.py @ 14408:054da1e0afbe

record: use cmdutil.command decorator
author Idan Kamara <idankk86@gmail.com>
date Sun, 22 May 2011 16:10:03 +0300
parents 51cabd567ac6
children 4eb88d296f63
line wrap: on
line diff
--- a/hgext/record.py	Sun May 22 16:10:02 2011 +0300
+++ b/hgext/record.py	Sun May 22 16:10:03 2011 +0300
@@ -12,6 +12,9 @@
 from mercurial import util
 import copy, cStringIO, errno, os, re, shutil, tempfile
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
 
 def scanpatch(fp):
@@ -341,6 +344,9 @@
     return sum([h for h in applied.itervalues()
                if h[0].special() or len(h) > 1], [])
 
+@command("record",
+         commands.table['^commit|ci'][1], # same options as commit
+          _('hg record [OPTION]... [FILE]...'))
 def record(ui, repo, *pats, **opts):
     '''interactively select changes to commit
 
@@ -529,15 +535,9 @@
     finally:
         ui.write = oldwrite
 
-cmdtable = {
-    "record":
-        (record, commands.table['^commit|ci'][1], # same options as commit
-         _('hg record [OPTION]... [FILE]...')),
-    "qrecord":
-        (qrecord, {}, # placeholder until mq is available
-         _('hg qrecord [OPTION]... PATCH [FILE]...')),
-}
-
+cmdtable["qrecord"] = \
+    (qrecord, {}, # placeholder until mq is available
+     _('hg qrecord [OPTION]... PATCH [FILE]...'))
 
 def uisetup(ui):
     try:
@@ -545,11 +545,6 @@
     except KeyError:
         return
 
-    qcmdtable = {
-    "qrecord":
+    cmdtable["qrecord"] = \
         (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
-         _('hg qrecord [OPTION]... PATCH [FILE]...')),
-    }
-
-    cmdtable.update(qcmdtable)
-
+         _('hg qrecord [OPTION]... PATCH [FILE]...'))