Mercurial > hg
changeset 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 | 08d84bdce1a5 |
children | 8f551386abf0 |
files | hgext/mq.py tests/test-mq.t |
diffstat | 2 files changed, 23 insertions(+), 1 deletions(-) [+] |
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"))]
--- 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