[PATCH 2 of 5 RFC] revset: add a predicate for finding transplants

Matt Harbison matt_harbison at yahoo.com
Mon May 14 19:21:21 CDT 2012


--- On Mon, 5/14/12, Matt Mackall <mpm at selenic.com> wrote:

> From: Matt Mackall <mpm at selenic.com>
> Subject: Re: [PATCH 2 of 5 RFC] revset: add a predicate for finding transplants
> To: "Matt Harbison" <matt_harbison at yahoo.com>
> Cc: mercurial-devel at selenic.com
> Date: Monday, May 14, 2012, 3:35 AM
> On Mon, 2012-05-14 at 01:30 -0400,
> Matt Harbison wrote:
> 
> > Questions:
> 
> > - Since both predicates without a revision select the
> destination changesets,
> >   there's nothing to find all nodes that
> are transplant sources.  Should I add
> >   one more predicate to select the
> source or all sources?  I can't think of a
> >   good name. (I suppose this applies to
> all except convert).
> 
> ??

The source hash for a convert is stored, but that revision is in another repo.  So even if you could get it into a revset, you can't do anything with it (log, strip etc), can you?

> 
> > - Given that the goal is to find where a changeset is
> propagated, it didn't
> >   seem to make sense to support taking
> in a set.  Or should it use
> >   revset.getset() anyway and make sure
> the size is 1 if a rev is provided?
> >   rev() and id() didn't take this
> route.
> 
> I can see use-cases for this, for instance:
> 
>  grafted(branch(default))  # find anything that's a
> graft from default
> 
> ..but I also think we want:
> 
>  grafted()
>
> But really, I think we want a single predicate that will
> identify any of
> grafted/rebased/transplanted/converted. Perhaps:
> 
>  origin([id|set])

I like that name.  And the fact that you only need one because you can do origin(grafted()) or something to filter is really cool.  But can you provide a use case for this?  I was originally thinking this was the least useful and only mentioned it for completeness.  If you have a rev and want to see its (immediate) origin, what is really desired is a way to peek at the extra field for that rev- probably a template keyword so that log prints that src rev instead of hg --debug log -r <rev>.

OTOH, if you have a changeset A, perform a {graft|rebase|transplant} op and it becomes B, then another op on B so it becomes C, an origin(C) revset could add B because it is referenced in C's extra, and then add A because it is referenced in B's extra and you would have the whole progression.  Not sure if this is what you meant, or if you meant origin([rev]) selects the source of the most recent op on that node.
 


More information about the Mercurial-devel mailing list