diff hgext/mq.py @ 14210:68ade2a6b30a

mq: add a 'mq()' revset predicate that returns applied mq csets
author Idan Kamara <idankk86@gmail.com>
date Fri, 06 May 2011 16:07:35 +0300
parents e1c34ce39fae
children 967be4bb42a7
line wrap: on
line diff
--- 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"))]