# HG changeset patch # User Pierre-Yves David # Date 1534266935 -7200 # Node ID 47dd383a995569536cbbae5f32527c43ef3341eb # Parent 4ef3800c9bf82fb059270ed311b31f0ffb160921 compat: use new style template keyword declaration diff -r 4ef3800c9bf8 -r 47dd383a9955 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Tue Aug 14 18:32:30 2018 +0200 +++ b/hgext3rd/topic/__init__.py Tue Aug 14 19:15:35 2018 +0200 @@ -132,7 +132,6 @@ registrar, scmutil, templatefilters, - templatekw, util, ) @@ -231,6 +230,8 @@ default=None, ) +templatekeyword = registrar.templatekeyword() + def _contexttopic(self, force=False): if not (force or self.mutable()): return '' @@ -338,7 +339,6 @@ cmdutil.summaryhooks.add('topic', summaryhook) - templatekw.keywords['topic'] = topickw # Wrap workingctx extra to return the topic name extensions.wrapfunction(context.workingctx, '__init__', wrapinit) # Wrap changelog.add to drop empty topic @@ -510,9 +510,11 @@ 'topics', 'topic', namemap=_namemap, nodemap=_nodemap, listnames=lambda repo: repo.topics)) -def topickw(**args): +@templatekeyword('topic', requires={'ctx'}) +def topickw(context, mapping): """:topic: String. The topic of the changeset""" - return args['ctx'].topic() + ctx = context.resource(mapping, 'ctx') + return ctx.topic() def wrapinit(orig, self, repo, *args, **kwargs): orig(self, repo, *args, **kwargs)