[PATCH 8 of 8 V2] fileset: add a 'status(...)' predicate to control evaluation context
Yuya Nishihara
yuya at tcha.org
Tue Mar 7 09:13:33 EST 2017
On Mon, 06 Mar 2017 10:36:55 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1488546500 -3600
> # Fri Mar 03 14:08:20 2017 +0100
> # Node ID 41ea8aee85ca16d652dfdb4afe37053b291702b4
> # Parent 9d6e733046b9aa7e2ded8c4207625fedcc2a8c04
> # EXP-Topic filesetrev-func
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> # hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 41ea8aee85ca
> fileset: add a 'status(...)' predicate to control evaluation context
Looks good, thanks. I've marked these as 2nd Review Requested since I was too
involved to this series.
> + at predicate('status(base, rev, pattern)')
> +def status(mctx, x):
> + """``status(base, rev, revspec)``
> +
> + Evaluate predicate using status change between ``base`` and
> + ``rev``. Examples:
> +
> + - ``status(3, 7, added())`` - matches files added from "3" to "7"
> + """
> + repo = mctx.ctx.repo()
> + # i18n: "status" is a keyword
> + b, r, x = getargs(x, 3, 3, _("status takes three arguments"))
> + # i18n: "status" is a keyword
> + baseerr = _("first argument to status must be a revision")
> + baserevspec = getstring(b, baseerr)
> + if not baserevspec:
> + raise error.ParseError(baseerr)
Nit: need to insert "# i18n: "status" is a keyword" comment here.
> + reverr = _("second argument to status must be a revision")
> + revspec = getstring(r, reverr)
> + if not revspec:
> + raise error.ParseError(reverr)
> + basenode, node = scmutil.revpair(repo, [baserevspec, revspec])
> + basectx = repo[basenode]
> + ctx = repo[node]
> + return getset(mctx.switch(ctx, _buildstatus(ctx, x, basectx=basectx)), x)
More information about the Mercurial-devel
mailing list