[PATCH 3 of 8 V2] revset: add origin() predicate

Matt Mackall mpm at selenic.com
Wed Jun 20 13:19:51 CDT 2012


On Fri, 2012-06-08 at 00:58 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1337140860 14400
> # Node ID 9eb8327a534e2f16d66b036771ebaceac93d4b2a
> # Parent  356bb037ddc0c9ee510cb46e379bc715bce9e139
> revset: add origin() predicate
> +def origin(repo, subset, x):
> +    """``origin([set])``
> +    Changesets that were grafted, transplanted or rebased from the given
> +    revisions, or the parent of the working directory.
> +    """
> +    if x:
> +        s = getset(repo, subset, x)
> +    else:
> +        s = tuple(p.rev() for p in repo[None].parents())
> +
> +    return [r for r in xrange(0, len(repo)) if _getrevsource(repo, r) in s]

Looks like you haven't quite grokked the purpose of subset. It exists to
narrow the scope of inquiry. So if I do:

 hg log -r 'head() and origin(x)' 

I need only check the origin of branch heads rather than every revision
in the repository.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list