This revision was automatically updated to reflect the committed changes.
Closed by commit rHGea02be8665ef: narrowtemplates: update to use registrar 
mechanism (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2009?vs=5514&id=5553

REVISION DETAIL
  https://phab.mercurial-scm.org/D2009

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowtemplates.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py
--- a/hgext/narrow/narrowtemplates.py
+++ b/hgext/narrow/narrowtemplates.py
@@ -8,24 +8,29 @@
 from __future__ import absolute_import
 
 from mercurial import (
+    registrar,
     revlog,
-    revset,
-    templatekw,
     util,
 )
 
+keywords = {}
+templatekeyword = registrar.templatekeyword(keywords)
+revsetpredicate = registrar.revsetpredicate()
+
 def _isellipsis(repo, rev):
     if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS:
         return True
     return False
 
+@templatekeyword('ellipsis')
 def ellipsis(repo, ctx, templ, **args):
     """:ellipsis: String. 'ellipsis' if the change is an ellipsis node,
     else ''."""
     if _isellipsis(repo, ctx.rev()):
         return 'ellipsis'
     return ''
 
+@templatekeyword('outsidenarrow')
 def outsidenarrow(repo, ctx, templ, **args):
     """:outsidenarrow: String. 'outsidenarrow' if the change affects no
     tracked files, else ''."""
@@ -35,15 +40,9 @@
             return 'outsidenarrow'
     return ''
 
+@revsetpredicate('ellipsis')
 def ellipsisrevset(repo, subset, x):
     """``ellipsis()``
     Changesets that are ellipsis nodes.
     """
     return subset.filter(lambda r: _isellipsis(repo, r))
-
-def setup():
-    templatekw.keywords['ellipsis'] = ellipsis
-    templatekw.keywords['outsidenarrow'] = outsidenarrow
-
-    revset.symbols['ellipsis'] = ellipsisrevset
-    revset.safesymbols.add('ellipsis')
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -62,7 +62,6 @@
     narrowrevlog.setup()
     narrowbundle2.setup()
     narrowmerge.setup()
-    narrowtemplates.setup()
     narrowcommands.setup()
     narrowchangegroup.setup()
     narrowwirepeer.uisetup()
@@ -91,3 +90,6 @@
     extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit)
     extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare)
     extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec)
+
+templatekeyword = narrowtemplates.templatekeyword
+revsetpredicate = narrowtemplates.revsetpredicate



To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to