Mercurial > evolve
changeset 4330:9d2d0ebc6456
exthelper: simplify the ability to register filesets
Same mechanism as revsets earlier in this series.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 27 Dec 2018 23:46:35 -0500 |
parents | 798298fda3be |
children | 594495e1e47e |
files | hgext3rd/evolve/exthelper.py |
diffstat | 1 files changed, 2 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/exthelper.py Thu Dec 27 21:55:22 2018 -0500 +++ b/hgext3rd/evolve/exthelper.py Thu Dec 27 23:46:35 2018 -0500 @@ -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