[PATCH 10 of 35] record: declare commands using decorator

Gregory Szorc gregory.szorc at gmail.com
Mon May 5 00:51:15 CDT 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1399268137 25200
#      Sun May 04 22:35:37 2014 -0700
# Branch stable
# Node ID d29ede43f707818fe796cb5e8fd44367de6c9e0b
# Parent  2cfe4a1d739b46f3daa9956a418b6293e78c0922
record: declare commands using decorator

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -454,16 +454,18 @@ def qrefresh(origfn, ui, repo, *pats, **
         # were accepted. All other changes were reverted.
         # We can't pass *pats here since qrefresh will undo all other
         # changed files in the patch that aren't in pats.
         mq.refresh(ui, repo, **opts)
 
     # backup all changed files
     dorecord(ui, repo, committomq, 'qrefresh', True, *pats, **opts)
 
+# This command registration is replaced during uisetup().
+ at command('qrecord', [], _('hg qrecord [OPTION]... PATCH [FILE]...'))
 def qrecord(ui, repo, patch, *pats, **opts):
     '''interactively record a new patch
 
     See :hg:`help qnew` & :hg:`help record` for more information and
     usage.
     '''
 
     try:
@@ -632,20 +634,16 @@ def dorecord(ui, repo, commitfunc, cmdsu
             orig(chunk, label=label + l)
     oldwrite = ui.write
     extensions.wrapfunction(ui, 'write', wrapwrite)
     try:
         return cmdutil.commit(ui, repo, recordfunc, pats, opts)
     finally:
         ui.write = oldwrite
 
-cmdtable["qrecord"] = \
-    (qrecord, [], # placeholder until mq is available
-     _('hg qrecord [OPTION]... PATCH [FILE]...'))
-
 def uisetup(ui):
     try:
         mq = extensions.find('mq')
     except KeyError:
         return
 
     cmdtable["qrecord"] = \
         (qrecord,


More information about the Mercurial-devel mailing list