Revset search syntax in hgweb

Matt Mackall mpm at selenic.com
Mon Jul 8 15:37:08 CDT 2013


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.

> 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.

http://www.regular-expressions.info/catastrophic.html

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial-devel mailing list