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

Patrick Mézard patrick at mezard.eu
Thu Jun 21 04:09:17 CDT 2012


Le 08/06/12 06:58, Matt Harbison a écrit :
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1337140860 14400
> # Node ID 9eb8327a534e2f16d66b036771ebaceac93d4b2a
> # Parent  356bb037ddc0c9ee510cb46e379bc715bce9e139
> revset: add origin() predicate

[...]

> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -878,6 +878,18 @@
>  
>      return [r for r in subset if r == rn]
>  
> +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())

Don't you want to turn s into a set()? (no, getset() does not return sets...)

> +
> +    return [r for r in xrange(0, len(repo)) if _getrevsource(repo, r) in s]
> +
>  def outgoing(repo, subset, x):
>      """``outgoing([path])``
>      Changesets not found in the specified destination repository, or the
> @@ -1360,6 +1372,7 @@
>      "merge": merge,
>      "min": minrev,
>      "modifies": modifies,
> +    "origin": origin,
>      "outgoing": outgoing,
>      "p1": p1,
>      "p2": p2,


More information about the Mercurial-devel mailing list