Mercurial > hg-stable
changeset 14679:e141e1cee0cc
fileset: add resolved and unresolved predicates
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:53:49 -0500 |
parents | 5ef7b87530f6 |
children | 49af5fa3809b |
files | mercurial/fileset.py |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/fileset.py Sat Jun 18 16:53:49 2011 -0500 +++ b/mercurial/fileset.py Sat Jun 18 16:53:49 2011 -0500 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import parser, error, util +import parser, error, util, merge from i18n import _ elements = { @@ -175,6 +175,20 @@ getargs(x, 0, 0, _("symlink takes no arguments")) return [f for f in mctx.subset if mctx.ctx.flags(f) == 'l'] +def resolved(mctx, x): + getargs(x, 0, 0, _("resolved takes no arguments")) + if mctx.ctx.rev() is not None: + return [] + ms = merge.mergestate(mctx.ctx._repo) + return [f for f in mctx.subset if f in ms and ms[f] == 'r'] + +def unresolved(mctx, x): + getargs(x, 0, 0, _("unresolved takes no arguments")) + if mctx.ctx.rev() is not None: + return [] + ms = merge.mergestate(mctx.ctx._repo) + return [f for f in mctx.subset if f in ms and ms[f] == 'u'] + symbols = { 'added': added, 'binary': binary, @@ -184,8 +198,10 @@ 'ignored': ignored, 'modified': modified, 'removed': removed, + 'resolved': resolved, 'symlink': symlink, 'unknown': unknown, + 'unresolved': unresolved, } methods = {