Match a revset pattern against repo.changegroup?

Angel Ezquerra angel.ezquerra at gmail.com
Sun Oct 9 16:14:52 CDT 2011


On Sun, Oct 9, 2011 at 10:51 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Sun, 2011-10-09 at 22:13 +0200, Angel Ezquerra wrote:
>> Hi,
>>
>> is there an easy way to match a revset pattern against the received
>> changegroup on the pretxnchangegroup hook?
>
> Check out repo.set(). This is slightly tricky because it doesn't (yet)
> have a way to include a sub-expression:
>
> for ctx in repo.set("%%n:: and (%s)" % revsetexpr, firstincomingnode):
>    print "bad", ctx.rev()

Thank you!

I was a bit confused by the %%n, until I read the docstring of the
revset.formatspec function. For those who don't know, %n is equivalent
to "hex(arg)".

BTW, is there a better way to get the list of revisions that are being
pushed during the pretxnchangegroup hook?

Angel


More information about the Mercurial-devel mailing list