Revset search syntax in hgweb

Alexander Plavin me at aplavin.ru
Mon Jul 8 16:52:13 CDT 2013


2013/7/9 Matt Mackall <mpm at selenic.com>:
> 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)

Overall yes, first it checks if the specified query exists in the repo
(I mean Python code like 'rev in repo', which checks for both revision
number and node hash), and if not runs search function, which checks
for all words (splitted by space) from query to be in one of the
fields: user, description, filenames.

>
> So we should probably amend that to:
>
> - revision, if it exists
> - node, if it exists
> - revset, if we can parse it
> - keyword

I like this most too, it's almost the same as my 'a)' variant. So, the
search function would check for revset parseability and act
correspondingly.

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