[PATCH 5 of 6] parser: move _relabelaliasargs() to common rule-set class

Yuya Nishihara yuya at tcha.org
Fri Apr 1 22:54:11 EDT 2016


On Fri, 1 Apr 2016 14:35:16 -0700, Pierre-Yves David wrote:
> On 04/01/2016 08:37 AM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1456736451 -32400
> > #      Mon Feb 29 18:00:51 2016 +0900
> > # Node ID d5414d3c08bbffc3ef6ad3fa3268d3d43b25afad
> > # Parent  2a3e01c30ddc08a5ff331b8d9b30ac8c014090d6
> > parser: move _relabelaliasargs() to common rule-set class
> >
> > revset._relabelaliasargs() will be removed soon.
> >
> > diff --git a/mercurial/parser.py b/mercurial/parser.py
> > --- a/mercurial/parser.py
> > +++ b/mercurial/parser.py
> > @@ -290,3 +290,18 @@ class aliasrules(object):
> >               return (name, tree[:2], args, None)
> >
> >           return (decl, None, None, _("invalid format"))
> > +
> > +    def _relabelargs(self, tree, args):  
> 
> Can we get some details about what this function is about, that would 
> help me following what is going on here.

will do.

> >   def _relabelaliasargs(tree, args):
> > -    if not isinstance(tree, tuple):
> > -        return tree
> > -    op = tree[0]
> > -    if op != 'symbol':
> > -        return (op,) + tuple(_relabelaliasargs(x, args) for x in tree[1:])
> > -
> > -    assert len(tree) == 2
> > -    sym = tree[1]
> > -    if sym in args:
> > -        op = '_aliasarg'
> > -    elif sym.startswith('$'):
> > -        raise error.ParseError(_("'$' not for alias arguments"))
> > -    return (op, sym)
> > +    return parser.aliasrules('', None, None, None)._relabelargs(tree, args)  
> 
> Urg, that's not a very pretty call, I assume this is temporary. What 
> would this looks like eventually?

This line is removed by the next patch.


More information about the Mercurial-devel mailing list