hgext/mq.py
changeset 11107 9c72c5c094aa
parent 11078 37d1b20168d1
child 11119 2e270443a2c6
--- a/hgext/mq.py	Fri May 07 14:07:30 2010 -0500
+++ b/hgext/mq.py	Wed May 05 20:53:45 2010 -0500
@@ -2662,10 +2662,26 @@
         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)
+    q = repo.mq
+    m = []
+    a, u = len(q.applied), len(q.unapplied(repo))
+    if a:
+        m.append(_("%d applied") % a)
+    if u:
+        m.append(_("%d unapplied") % u)
+    if m:
+        ui.write("mq:     %s\n" % ', '.join(m))
+    else:
+        ui.note("mq:     (empty queue)\n")
+    return r
+
 def uisetup(ui):
     mqopt = [('', 'mq', None, _("operate on patch repository"))]
 
     extensions.wrapcommand(commands.table, 'import', mqimport)
+    extensions.wrapcommand(commands.table, 'summary', summary)
 
     entry = extensions.wrapcommand(commands.table, 'init', mqinit)
     entry[1].extend(mqopt)