compat: register a version of 'obsfatedata' template that works with 4.6
Since showlist is deprecated, let us use compatlist.
--- a/hgext3rd/evolve/templatekw.py Sun Mar 04 17:09:41 2018 -0500
+++ b/hgext3rd/evolve/templatekw.py Sun Mar 04 17:41:45 2018 -0500
@@ -260,13 +260,33 @@
return "\n".join(lines)
-@eh.templatekw("obsfatedata")
-def showobsfatedata(repo, ctx, **args):
- # Get the needed obsfate data
- values = obsfatedata(repo, ctx)
+
+if util.safehasattr(templatekw, 'compatlist'):
+ @eh.templatekw('obsfatedata', requires=set(['ctx', 'templ']))
+ def showobsfatedata(context, mapping):
+ ctx = context.resource(mapping, 'ctx')
+ repo = ctx.repo()
+ values = obsfatedata(repo, ctx)
- if values is None:
- return templatekw.showlist("obsfatedata", [], args)
+ if values is None:
+ return templatekw.compatlist(context, mapping, "obsfatedata", [])
+ args = mapping.copy()
+ args.pop('ctx')
+ args['templ'] = context.resource(mapping, 'templ')
+ return _showobsfatedata(repo, ctx, values, **args)
+else:
+ # pre hg-4.6
+ @eh.templatekw("obsfatedata")
+ def showobsfatedata(repo, ctx, **args):
+ # Get the needed obsfate data
+ values = obsfatedata(repo, ctx)
+
+ if values is None:
+ return templatekw.showlist("obsfatedata", [], args)
+
+ return _showobsfatedata(repo, ctx, values, **args)
+
+def _showobsfatedata(repo, ctx, values, **args):
# Format each successorset successors list
for raw in values: