[PATCH 2 of 5] mq: switch to new summary hook mechanism

Bryan O'Sullivan bos at serpentine.com
Tue May 14 13:24:28 CDT 2013


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1368555796 25200
#      Tue May 14 11:23:16 2013 -0700
# Node ID 199ddb0df8d7dc9d3a180b9bb5474aecf68213b4
# Parent  50703ffc65cfec6e37f31c74da5e2acf22c9ac08
mq: switch to new summary hook mechanism

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3533,8 +3533,7 @@ def mqcommand(orig, ui, repo, *args, **k
         raise util.Abort(_('no queue repository'))
     return orig(r.ui, r, *args, **kwargs)
 
-def summary(orig, ui, repo, *args, **kwargs):
-    r = orig(ui, repo, *args, **kwargs)
+def summaryhook(ui, repo):
     q = repo.mq
     m = []
     a, u = len(q.applied), len(q.unapplied(repo))
@@ -3548,7 +3547,6 @@ def summary(orig, ui, repo, *args, **kwa
     else:
         # i18n: column positioning for "hg summary"
         ui.note(_("mq:     (empty queue)\n"))
-    return r
 
 def revsetmq(repo, subset, x):
     """``mq()``
@@ -3567,7 +3565,7 @@ def extsetup(ui):
     mqopt = [('', 'mq', None, _("operate on patch repository"))]
 
     extensions.wrapcommand(commands.table, 'import', mqimport)
-    extensions.wrapcommand(commands.table, 'summary', summary)
+    cmdutil.summaryhooks.add('mq', summaryhook)
 
     entry = extensions.wrapcommand(commands.table, 'init', mqinit)
     entry[1].extend(mqopt)


More information about the Mercurial-devel mailing list