[PATCH 6 of 7 evolve-ext] exthelper: simplify the ability to register filesets

Matt Harbison mharbison72 at gmail.com
Thu Jan 3 00:30:53 EST 2019


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1545972395 18000
#      Thu Dec 27 23:46:35 2018 -0500
# Node ID 0579af34a326c7a8d88aac713202bb6e90436bae
# Parent  b7614af59abdce79169487c8887ccb404e411ddf
exthelper: simplify the ability to register filesets

Same mechanism as revsets earlier in this series.

diff --git a/hgext3rd/evolve/exthelper.py b/hgext3rd/evolve/exthelper.py
--- a/hgext3rd/evolve/exthelper.py
+++ b/hgext3rd/evolve/exthelper.py
@@ -13,7 +13,6 @@
     commands,
     error,
     extensions,
-    fileset as filesetmod,
     registrar,
 )
 
@@ -31,7 +30,6 @@
         self._uicallables = []
         self._extcallables = []
         self._repocallables = []
-        self._filesetsymbols = []
         self._commandwrappers = []
         self._extcommandwrappers = []
         self._functionwrappers = []
@@ -49,6 +47,7 @@
 
         self.configtable = {}
         self.configitem = registrar.configitem(self.configtable)
+        self.filesetpredicate = registrar.filesetpredicate()
         self.revsetpredicate = registrar.revsetpredicate()
         self.templatekeyword = registrar.templatekeyword()
 
@@ -57,8 +56,8 @@
         self._uipopulatecallables.extend(other._uipopulatecallables)
         self._extcallables.extend(other._extcallables)
         self._repocallables.extend(other._repocallables)
+        self.filesetpredicate._table.update(other.filesetpredicate._table)
         self.revsetpredicate._table.update(other.revsetpredicate._table)
-        self._filesetsymbols.extend(other._filesetsymbols)
         self.templatekeyword._table.update(other.templatekeyword._table)
         self._commandwrappers.extend(other._commandwrappers)
         self._extcommandwrappers.extend(other._extcommandwrappers)
@@ -125,12 +124,6 @@
         """
         knownexts = {}
 
-        filesetpredicate = registrar.filesetpredicate()
-        for name, symbol in self._filesetsymbols:
-            filesetpredicate(name)(symbol)
-        # TODO: Figure out the calling extension name
-        filesetmod.loadpredicate(ui, 'exthelper', filesetpredicate)
-
         for ext, command, wrapper, opts in self._extcommandwrappers:
             if ext not in knownexts:
                 try:
@@ -208,23 +201,6 @@
         self._repocallables.append(call)
         return call
 
-    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 wrapcommand(self, command, extension=None, opts=None):
         """Decorated function is a command wrapper
 


More information about the Mercurial-devel mailing list