Patchwork [3,of,3] revset: define _parsealias() in _aliasrules class

login
register
mail settings
Submitter Yuya Nishihara
Date May 4, 2016, 12:11 p.m.
Message ID <e5d489376621dff13f1d.1462363903@mimosa>
Download mbox | patch
Permalink /patch/14879/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Yuya Nishihara - May 4, 2016, 12:11 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1460866004 -32400
#      Sun Apr 17 13:06:44 2016 +0900
# Node ID e5d489376621dff13f1d72f0d8efe2f5385da400
# Parent  478eb6b0fcd9b91fdc34d9ee763ad093bc1a06e7
revset: define _parsealias() in _aliasrules class

It's short. It doesn't make sense to define _parsealias() outside of the
class.
Sean Farley - May 4, 2016, 11:10 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1460866004 -32400
> #      Sun Apr 17 13:06:44 2016 +0900
> # Node ID e5d489376621dff13f1d72f0d8efe2f5385da400
> # Parent  478eb6b0fcd9b91fdc34d9ee763ad093bc1a06e7
> revset: define _parsealias() in _aliasrules class
>
> It's short. It doesn't make sense to define _parsealias() outside of the
> class.

These look fine to me at first glance.
Augie Fackler - May 5, 2016, 3:31 a.m.
On Wed, May 04, 2016 at 04:10:26PM -0700, Sean Farley wrote:
>
> Yuya Nishihara <yuya@tcha.org> writes:
>
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1460866004 -32400
> > #      Sun Apr 17 13:06:44 2016 +0900
> > # Node ID e5d489376621dff13f1d72f0d8efe2f5385da400
> > # Parent  478eb6b0fcd9b91fdc34d9ee763ad093bc1a06e7
> > revset: define _parsealias() in _aliasrules class
> >
> > It's short. It doesn't make sense to define _parsealias() outside of the
> > class.
>
> These look fine to me at first glance.

Queued these, thanks.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2238,19 +2238,19 @@  def _parsewith(spec, lookup=None, symini
         raise error.ParseError(_('invalid token'), pos)
     return parser.simplifyinfixops(tree, ('list', 'or'))
 
-def _parsealias(spec):
-    """Parse alias declaration/definition ``spec``
-
-    This allows symbol names to use also ``$`` as an initial letter
-    (for backward compatibility), and callers of this function should
-    examine whether ``$`` is used also for unexpected symbols or not.
-    """
-    return _parsewith(spec, syminitletters=_aliassyminitletters)
-
 class _aliasrules(parser.basealiasrules):
     """Parsing and expansion rule set of revset aliases"""
     _section = _('revset alias')
-    _parse = staticmethod(_parsealias)
+
+    @staticmethod
+    def _parse(spec):
+        """Parse alias declaration/definition ``spec``
+
+        This allows symbol names to use also ``$`` as an initial letter
+        (for backward compatibility), and callers of this function should
+        examine whether ``$`` is used also for unexpected symbols or not.
+        """
+        return _parsewith(spec, syminitletters=_aliassyminitletters)
 
     @staticmethod
     def _trygetfunc(tree):