--- a/hgext3rd/topic/__init__.py Tue Aug 21 15:30:54 2018 +0200
+++ b/hgext3rd/topic/__init__.py Tue Aug 21 15:32:02 2018 +0200
@@ -132,7 +132,6 @@
registrar,
scmutil,
templatefilters,
- templatekw,
util,
)
@@ -149,13 +148,8 @@
topicmap,
)
-if util.safehasattr(registrar, 'command'):
- commandfunc = registrar.command
-else: # compat with hg < 4.3
- commandfunc = cmdutil.command
-
cmdtable = {}
-command = commandfunc(cmdtable)
+command = registrar.command(cmdtable)
colortable = {'topic.active': 'green',
'topic.list.troubledcount': 'red',
'topic.list.headcount.multiple': 'yellow',
@@ -181,7 +175,7 @@
'topic.active': 'green',
}
-__version__ = '0.10.1.dev'
+__version__ = '0.11.0.dev'
testedwith = '4.3.3 4.4.2 4.5.2 4.6.2 4.7'
minimumhgversion = '4.3'
@@ -231,6 +225,8 @@
default=None,
)
+templatekeyword = registrar.templatekeyword()
+
def _contexttopic(self, force=False):
if not (force or self.mutable()):
return ''
@@ -338,7 +334,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 +505,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)