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

Yuya Nishihara yuya at tcha.org
Wed May 4 08:11:43 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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):


More information about the Mercurial-devel mailing list