--- a/hgext/mq.py Fri May 06 10:17:07 2011 -0500
+++ b/hgext/mq.py Fri May 06 16:07:35 2011 +0300
@@ -45,7 +45,7 @@
from mercurial.i18n import _
from mercurial.node import bin, hex, short, nullid, nullrev
from mercurial.lock import release
-from mercurial import commands, cmdutil, hg, patch, scmutil, util
+from mercurial import commands, cmdutil, hg, patch, scmutil, util, revset
from mercurial import repair, extensions, url, error
import os, sys, re, errno, shutil
@@ -3096,6 +3096,20 @@
ui.note(_("mq: (empty queue)\n"))
return r
+def revsetmq(repo, subset, x):
+ """``mq()``
+ Changesets managed by MQ.
+ """
+ revset.getargs(x, 0, 0, _("mq takes no arguments"))
+ applied = set([repo[r.node].rev() for r in repo.mq.applied])
+ return [r for r in subset if r in applied]
+
+def extsetup(ui):
+ revset.symbols['mq'] = revsetmq
+
+# tell hggettext to extract docstrings from these functions:
+i18nfunctions = [revsetmq]
+
def uisetup(ui):
mqopt = [('', 'mq', None, _("operate on patch repository"))]
--- a/tests/test-mq.t Fri May 06 10:17:07 2011 -0500
+++ b/tests/test-mq.t Fri May 06 16:07:35 2011 +0300
@@ -843,6 +843,14 @@
1 foo qbase
2 bar qtip tip
+mq revset
+
+ $ hg log -r 'mq()' --template '{rev}\n'
+ 1
+ 2
+ $ hg help revsets | grep -i mq
+ "mq()"
+ Changesets managed by MQ.
bad node in status