Revset search syntax in hgweb

Matt Mackall mpm at selenic.com
Mon Jul 8 16:43:44 CDT 2013


On Tue, 2013-07-09 at 01:07 +0400, Alexander Plavin wrote:
> 2013/7/9 Matt Mackall <mpm at selenic.com>:
> > 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?

Hmm, perhaps not. If I recall correctly, hgweb can interpret a query in
three ways currently:

- revision, if it exists
- node, if it exists
- keyword(s)

So we should probably amend that to:

- revision, if it exists
- node, if it exists
- revset, if we can parse it
- keyword

But please propose a cascade with examples if you disagree.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list