[PATCH 3 of 6 V2] exthelper: drop fileset/revset/template support for now
Matt Harbison
mharbison72 at gmail.com
Sun Dec 23 01:15:48 EST 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1545536664 18000
# Sat Dec 22 22:44:24 2018 -0500
# Node ID 532b67da901af08c2d467f1fb175b6073ffb8762
# Parent 9c6e437729b7da29d5ee3d3b680a7810314b9d93
exthelper: drop fileset/revset/template support for now
Yuya raised concerns about duplicating registrar functionality. There are a
couple of ideas to work around this, which would allow bringing them back, and
then backporting to evolve. For now, I just want to get the subsequent changes
landed before the bulk b'' rewrite makes rebasing too hard.
diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py
--- a/mercurial/exthelper.py
+++ b/mercurial/exthelper.py
@@ -15,10 +15,7 @@ from . import (
commands,
configitems,
extensions,
- fileset as filesetmod,
registrar,
- revset as revsetmod,
- templatekw as templatekwmod,
)
class exthelper(object):
@@ -35,9 +32,6 @@ class exthelper(object):
self._uicallables = []
self._extcallables = []
self._repocallables = []
- self._revsetsymbols = []
- self._filesetsymbols = []
- self._templatekws = []
self._commandwrappers = []
self._extcommandwrappers = []
self._functionwrappers = []
@@ -61,9 +55,6 @@ class exthelper(object):
self._uipopulatecallables.extend(other._uipopulatecallables)
self._extcallables.extend(other._extcallables)
self._repocallables.extend(other._repocallables)
- self._revsetsymbols.extend(other._revsetsymbols)
- self._filesetsymbols.extend(other._filesetsymbols)
- self._templatekws.extend(other._templatekws)
self._commandwrappers.extend(other._commandwrappers)
self._extcommandwrappers.extend(other._extcommandwrappers)
self._functionwrappers.extend(other._functionwrappers)
@@ -126,29 +117,9 @@ class exthelper(object):
- Changes depending on the status of other extensions. (if
extensions.find('mq'))
- Add a global option to all commands
- - Register revset functions
"""
knownexts = {}
- revsetpredicate = registrar.revsetpredicate()
- for name, symbol in self._revsetsymbols:
- revsetpredicate(name)(symbol)
- revsetmod.loadpredicate(ui, 'evolve', revsetpredicate)
-
- filesetpredicate = registrar.filesetpredicate()
- for name, symbol in self._filesetsymbols:
- filesetpredicate(name)(symbol)
- # TODO: Figure out the calling extension name
- filesetmod.loadpredicate(ui, 'exthelper', filesetpredicate)
-
- templatekeyword = registrar.templatekeyword()
- for name, kw, requires in self._templatekws:
- if requires is not None:
- templatekeyword(name, requires=requires)(kw)
- else:
- templatekeyword(name)(kw)
- templatekwmod.loadkeyword(ui, 'evolve', templatekeyword)
-
for ext, command, wrapper, opts in self._extcommandwrappers:
if ext not in knownexts:
try:
@@ -226,58 +197,6 @@ class exthelper(object):
self._repocallables.append(call)
return call
- def revset(self, symbolname):
- """Decorated function is a revset symbol
-
- The name of the symbol must be given as the decorator argument.
- The symbol is added during `extsetup`.
-
- example::
-
- @eh.revset('hidden')
- def revsetbabar(repo, subset, x):
- args = revset.getargs(x, 0, 0, 'babar accept no argument')
- return [r for r in subset if 'babar' in repo[r].description()]
- """
- def dec(symbol):
- self._revsetsymbols.append((symbolname, symbol))
- return symbol
- return dec
-
- def fileset(self, symbolname):
- """Decorated function is a fileset symbol
-
- The name of the symbol must be given as the decorator argument.
- The symbol is added during `extsetup`.
-
- example::
-
- @eh.fileset('lfs()')
- def filesetbabar(mctx, x):
- return mctx.predicate(...)
- """
- def dec(symbol):
- self._filesetsymbols.append((symbolname, symbol))
- return symbol
- return dec
-
- def templatekw(self, keywordname, requires=None):
- """Decorated function is a template keyword
-
- The name of the keyword must be given as the decorator argument.
- The symbol is added during `extsetup`.
-
- example::
-
- @eh.templatekw('babar')
- def kwbabar(ctx):
- return 'babar'
- """
- def dec(keyword):
- self._templatekws.append((keywordname, keyword, requires))
- return keyword
- return dec
-
def wrapcommand(self, command, extension=None, opts=None):
"""Decorated function is a command wrapper
More information about the Mercurial-devel
mailing list