determining if a revision has a certain feature

Simon King simon at simonking.org.uk
Fri Aug 7 13:29:15 UTC 2015


On Fri, Aug 7, 2015 at 12:28 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> I'm fixing a program which collects results of my earlier program runs and
> plots them.  The plotter needs to know if the earlier run has a certain
> feature, which unfortunately I did not record in the logs.  But I did record
> the hg ID of the program run.
>
> So how can I tell if the hg ID that was run contains the feature?  I know
> what changeset introduced it, so I could query whether an hg ID has that
> changeset.  I believe this can be done with hg log?
>

You can use revsets for this: https://selenic.com/hg/help/revset

In your case, you want to know if a particular revision A is an
ancestor of another revision B. You could write that like this:

  hg log -r "ancestors(A) and B"

"and" is the "set intersection" operator, so if B is also in the
ancestors of A, this will return B. If it is *not* in the ancestors of
A, there will be no match.

Hope that helps,

Simon



More information about the Mercurial mailing list