[PATCH] record: use cmdutil.command decorator

Idan Kamara idankk86 at gmail.com
Sun May 22 08:30:27 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1306069803 -10800
# Node ID bfb95d57937c7c3e2ba88a08f37fe124bd7a3081
# Parent  937b1185cd56cd9649ff9a2403269746ebf76ad3
record: use cmdutil.command decorator

diff -r 937b1185cd56 -r bfb95d57937c hgext/record.py
--- 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], [])
 
+ at 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]...'))


More information about the Mercurial-devel mailing list