Please check out the revset feature

Matt Mackall mpm at selenic.com
Tue Jun 8 10:09:09 CDT 2010


On Tue, Jun 08, 2010 at 04:00:27PM +0200, Peter Arrenbrecht wrote:
> On Tue, Jun 8, 2010 at 3:23 PM, Peter Arrenbrecht
> <peter.arrenbrecht at gmail.com> wrote:
> > On Tue, Jun 8, 2010 at 3:06 PM, Peter Arrenbrecht
> > <peter.arrenbrecht at gmail.com> wrote:
> >> On Mon, Jun 7, 2010 at 6:16 PM, Matt Mackall <mpm at selenic.com> wrote:
> >>> Last week I pushed the revset feature to default. It's available
> >>> wherever revision ranges were previously supported. It's quite complex
> >>> and needs some testing. (And yes, there are currently no tests or docs!)
> >>> ...
> >>> ?x - y ?-> x & !y
> >>
> >> This seems to break branch names with dashes in them, as in:
> >>
> >> ?hg glog --rev p-root:tip
> >
> > I wonder if the following diff suggests that this will not be treated
> > as a regression.
> >
> > $ hg diff -c e581f3ac tests
> > diff --git a/tests/test-bookmarks b/tests/test-bookmarks
> > --- a/tests/test-bookmarks
> > +++ b/tests/test-bookmarks
> > @@ -82,7 +82,7 @@
> > ?hg bookmarks
> >
> > ?echo % look up stripped bookmark name
> > -hg log -r 'x ?y'
> > +hg log -r '"x ?y"'
> >
> > ?echo % reject bookmark name with newline
> > ?hg bookmark '
> 
> Just chatted with hstuart a bit. Ideas:
> 
> * Require spaces around operators.

We could, but for operators like ':,(!', that's not really what you want.

> * Make 'with-dash' first look up the name "with-dash". If there is no
> such name, fall back on the expression 'with - dash'. To be on the
> safe side, one could use spaces to force ' - ' to be an operator.

Horrors. x - y is just shorthand for "x and not y", so the simplest answer is
to just drop it.

Here are the characters that when included in a specifier will
effectively make it a query:

essential:   space ( ) " ' , :
convenience: ! & | - + ..

Of these, I think - and + are both pretty problematic but I'm not too
worried about the others. So we either need to drop some of the
convenience operators or mark queries specially.

In the past, ranges have been detected by the presence of a :, which
is why : is banned in tag names. We could for instance mark queries
like this:

hg log -r '?1.5::'

but it's a little unfortunate that this cuts us off from simply typing

hg log -r 1.5::

On the other hand, these simple :: expressions are about all you can
type without needing shell quoting.

Alternately, we could make the query test something hairy like:

if ':' in x or ' ' in x or '(' in x:

but that just seems to present weird corner cases like:

hg log -r 'tip&default'

The subspace of useful expressions without '( :' is pretty small but
it isn't quite empty.

Also, right now the parser insists that any identifier not matching
[a-z09._]+ be in quotes. Quoting allows any identifier to be
specified. This ought to be made a bit more liberal.

> * Accept this as changed behaviour, but at least explicitly specify _
> to never become an operator.

On reflection, I think the current approach is too aggressive.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list