Patchwork [6,of,8] exthelper: reintroduce the ability to register filesets

login
register
mail settings
Submitter Matt Harbison
Date Dec. 28, 2018, 6:47 a.m.
Message ID <1ff39d5b72312a9ae3c4.1545979640@Envy>
Download mbox | patch
Permalink /patch/37375/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 28, 2018, 6:47 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1545972395 18000
#      Thu Dec 27 23:46:35 2018 -0500
# Node ID 1ff39d5b72312a9ae3c4b9fc424fed25bbdd67b6
# Parent  75ad6f9b2df7c8f7d4d8b2613242cc46298e618c
exthelper: reintroduce the ability to register filesets

Same mechanism as revsets earlier in this series.  The LFS extension is updated
to provide test coverage.

Patch

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -140,7 +140,6 @@  from mercurial import (
     minifileset,
     node,
     pycompat,
-    registrar,
     repository,
     revlog,
     scmutil,
@@ -168,6 +167,7 @@  cmdtable = eh.cmdtable
 configtable = eh.configtable
 extsetup = eh.finalextsetup
 uisetup = eh.finaluisetup
+filesetpredicate = eh.filesetpredicate
 reposetup = eh.finalreposetup
 templatekeyword = eh.templatekeyword
 
@@ -200,7 +200,6 @@  eh.configitem('lfs', 'track',
 eh.configitem('lfs', 'retry',
     default=5,
 )
-filesetpredicate = registrar.filesetpredicate()
 
 lfsprocessor = (
     wrapper.readfromstore,
@@ -337,7 +336,7 @@  def _extsetup(ui):
     # "packed1". Using "packed1" with lfs will likely cause trouble.
     exchange._bundlespeccontentopts["v2"]["cg.version"] = "03"
 
-@filesetpredicate('lfs()')
+@eh.filesetpredicate('lfs()')
 def lfsfileset(mctx, x):
     """File that uses LFS storage."""
     # i18n: "lfs" is a keyword
diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py
--- a/mercurial/exthelper.py
+++ b/mercurial/exthelper.py
@@ -40,6 +40,7 @@  class exthelper(object):
         self.command = registrar.command(self.cmdtable)
         self.configtable = {}
         self.configitem = registrar.configitem(self.configtable)
+        self.filesetpredicate = registrar.filesetpredicate()
         self.revsetpredicate = registrar.revsetpredicate()
         self.templatekeyword = registrar.templatekeyword()
 
@@ -48,6 +49,7 @@  class exthelper(object):
         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.templatekeyword._table.update(other.templatekeyword._table)
         self._commandwrappers.extend(other._commandwrappers)