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

login
register
mail settings
Submitter Bryan O'Sullivan
Date May 14, 2013, 6:24 p.m.
Message ID <199ddb0df8d7dc9d3a18.1368555868@australite.thefacebook.com>
Download mbox | patch
Permalink /patch/1637/
State Accepted
Commit d0ba7022c13bd8a755769a16bcc83860e67ae5fb
Headers show

Comments

Bryan O'Sullivan - May 14, 2013, 6:24 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@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

Patch

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)