Bazaar Search Language brain dump
Jonathan Lange
jml at mumak.net
Fri Mar 6 04:45:07 GMT 2009
On Fri, Mar 6, 2009 at 5:33 PM, Ian Clatworthy
<ian.clatworthy at internode.on.net> wrote:
> Jono,
>
> Thinking about our discussion yesterday, I think we could do
> something pretty simple yet powerful. I'll write it up as a spec soon.
> Here's a brief summary though ...
>
> 1. log supports -s as a list option. Each value is a condition.
> (In the future, missing ought to support -s as well.)
>
> 2. Conditions are or-ed together by default. The --match-all-searches
> flag makes them and-ed together instead.
>
> 3. The syntax of a condition is ...
>
> attribute operator value
>
> 4. Supported attributes should include message, committer, authors
> and nick to begin with.
>
> 5. Supported operators are =, contains, in, !=, !contains, !in:
>
> * '=' is an exact string match
> * 'contains' is a substring match
> * 'in' looks up patterns (see bzr help patterns) in a file
> * ! negates the above.
>
> 6. Values are strings. Like revisionspecs and several other places in
> bzr, we support value schemes:
>
> * me: maps to the currently configured username
> * env:xx maps to the environment variable xx (in a cross-platform way)
> * value:xx maps to xx, allowing escaping of strings that look like a scheme.
>
> Implementation wise, we need a search parser that converts strings
> into a useful class, including the and vs or thing. We then extend
> the current log filter to match a Revision against that object instead
> of just always matching a plain string against the commit message.
>
> Anyhow, something to critique/hack together on the flight to next
> week's sprint. :-)
Two quick post-beer reactions:
1. Rob tells me that he and Andrew have talked a lot about this
between themselves.
2. The actual string to be parsed doesn't interest me a great deal --
we're Python programmers, the syntax won't be too awful. It's more
interesting to think about how one could expressively build these
queries in Python. I've been doing a lot of work using Storm recently
and would love an API like that. https://storm.canonical.com/Tutorial
if you aren't familiar.
I look forward to talking about this more!
jml
More information about the bazaar
mailing list