# HG changeset patch # User Pierre-Yves David # Date 1520203305 18000 # Node ID dc31ec3ef0426908f5a72f698365668a96408c56 # Parent 3597340497643f9c6ee919819e4a9dbe097c9ac4 compat: register a version of 'obsfatedata' template that works with 4.6 Since showlist is deprecated, let us use compatlist. diff -r 359734049764 -r dc31ec3ef042 hgext3rd/evolve/templatekw.py --- 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: