Revset search syntax in hgweb

Alexander Plavin me at
Mon Jul 8 16:07:32 CDT 2013

2013/7/9 Matt Mackall <mpm at>:
> On Thu, 2013-07-04 at 20:29 +0400, Alexander Plavin wrote:
>> Improving hgweb search by introducing revset syntax is a part of my
>> summer plan, and I'm having several questions about overall
>> implementing strategy of this feature and whether my understanding of
>> it is correct or not.
>> This feature is inspired by BitBucket, which has such thing in commits
>> search. They use revset-syntax search if such expression is specified,
>> and just simple search (similar to what is now in hgweb) otherwise.
>> One of the questions is how to distinguish the two cases. This can be
>> implemented by:
>> a) check if the specified expression is a revset expression: try to
>> parse it to a search tree and fallback if there is an error
>> b) always try the search which exists now first, and if nothing is
>> found use revset-syntax search (or the opposite way)
>> c) check for revset specifics: brackets and constructions like 'x::y'
>> d) just add a checkbox to switch revset syntax (seems unpreferable to me)
>> e) your ideas?
> Check how this was done for the command line in cmdutil:revrange.

As I understand, there firstly a try is made to parse old-style
ranges, and if it fails revset match is performed. But here in hgweb
there is a slightly different case, do you think this approach is the
best too?

>> Another question is about that we probably should ban heavyweight
> s/probably/definitely/
> It's easy to build revset queries that take minutes or hours to
> complete. Here's one:
> $ hg log -r "contains('set:grep(jane)')"
> That'll probably take over 10 minutes on the hg repo. Replace 'jane'
> with a malicious regex and it could take millenia.

It's clear that there are some very heavy-to-compute revset
expressions. I think we can just allow the same list of them, as
bitbucket does (it's listed in their popup help).

> --
> Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list