[PATCH 6 of 6] revset: parse nullary ":" operator as "0:tip"

Yuya Nishihara yuya at tcha.org
Sat Jul 18 05:32:31 CDT 2015


On Fri, 17 Jul 2015 15:21:28 -0700, Sean Farley wrote:
> Matt Mackall <mpm at selenic.com> writes:
> > On Fri, 2015-07-17 at 21:34 +0900, Yuya Nishihara wrote:
> >> # HG changeset patch
> >> # User Yuya Nishihara <yuya at tcha.org>
> >> # Date 1436066154 -32400
> >> #      Sun Jul 05 12:15:54 2015 +0900
> >> # Node ID c8c61831756e1f0e5c969ae2fd694ebc1ea4f7c9
> >> # Parent  8836e46ccea8e45da42b0e2eda90cb0e88880353
> >> revset: parse nullary ":" operator as "0:tip"
> >
> > Very nice. These are queued for default, thanks.
> >
> > Vaguely related: how much trouble will we get in if we try to use ^ as a
> > prefix operator to mean "child of"?
> 
> You is talking loco and I like it!

Is the idea like this?

  ^a        1st child of a
  ^^a       2nd child of a
  ^^^...^a  nth child of a

I can think of two problems:

 a) prefix "^" shadows suffix "^" because ambiguous suffix operator is taken
    as infix:

    a^^ -> (infix^ (infix^ (symbol "a") end))  (actual, parse error)
           (suffix^ (suffix^ (symbol "a")))    (expected)

 b) we can't specify <n>-th child as parameter

Perhaps (a) can be fixed if ambiguous operators are resolved by binding
strengths. It seems the current resolution is awkward:

  % hg debugrevspec -v 'a^:b'
  (parent
    ('symbol', 'a')
    (rangepre
      ('symbol', 'b')))

I think it should be taken as '(a^):b' because "^" has higher binding than ":".

  (range
    (parentpost
      ('symbol', 'a'))
    ('symbol', 'b'))


More information about the Mercurial-devel mailing list