diff --git a/mercurial/help/revsets.txt b/mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt +++ b/mercurial/help/revsets.txt @@ -122,6 +122,10 @@ The following predicates are supported: ``parents(set)`` The set of all parents for all changesets in set. +``present(set)`` + An empty set, if any revision in set isn't found; otherwise, + all revisions in set. + ``removes(pattern)`` Changesets which remove files matching pattern. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -378,6 +378,12 @@ def reverse(repo, subset, x): l.reverse() return l +def present(repo, subset, x): + try: + return getset(repo, subset, x) + except error.RepoLookupError: + return [] + def sort(repo, subset, x): l = getargs(x, 1, 2, _("sort wants one or two arguments")) keys = "rev" @@ -481,6 +487,7 @@ symbols = { "p1": p1, "p2": p2, "parents": parents, + "present": present, "removes": removes, "reverse": reverse, "roots": roots,