[PATCH] hgweb: add support for colon-separated revision format in search

Martin Geisler martin at geisler.net
Tue Jul 16 07:01:48 CDT 2013


Alexander Plavin <me at aplavin.ru> writes:

> # HG changeset patch
> # User Alexander Plavin <me at aplavin.ru>
> # Date 1373830561 -14400
> #      Sun Jul 14 23:36:01 2013 +0400
> # Node ID 52803877038ae1a817e467fb8d49cb584b984742
> # Parent  390ff286651b30b2a5f71a1901bb34aefec1c6f9
> hgweb: add support for colon-separated revision format in search
>
> Now it's possible to specify a revision in the format
> <definion 1>:<definition 2>, if <definion 1> and <definition 2> point to
> the same place, like in other parts of hg.

In other parts of Mercurial, this works because "x:y" means "changesets
with revision numbers between x and y" (see "hg help revsets").

The parsing of "x:y" is done by the revset parser, see revset.rangeset.
I would have imagined that the search in hgweb would use the same parser
so you avoid hard-coding parts of the revset syntax (specifically ":")
in hgweb.

Have you tried asking the Bitbucket guys (such as Brodie) if we can get
their backend code that restricts revsets to a safe subset? They might
be interested in open sourcing that code.

Alternatively, I think it should be possible to implement it again by
recursively searching through the parsed revset query (the parse tree)
and only allow queries where all functions are on a whitelist.

-- 
Martin Geisler


More information about the Mercurial-devel mailing list