# HG changeset patch # User Idan Kamara # Date 1306069803 -10800 # Node ID 054da1e0afbe1728a395830cfc769a2a01a7a3ef # Parent 51cabd567ac6e72d8a66301e2ed5532a1f1e06a2 record: use cmdutil.command decorator diff -r 51cabd567ac6 -r 054da1e0afbe 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], []) +@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]...'))