# HG changeset patch # User Anton Shestakov # Date 1583520220 -25200 # Node ID 2ccd7c97ed59aebef07f088d6adf425c2e076403 # Parent 9ac6779d608ce69166b5769b829c114dd544fe15 evolve: drop 4.5 compatibility for template keywords diff -r 9ac6779d608c -r 2ccd7c97ed59 hgext3rd/evolve/templatekw.py --- a/hgext3rd/evolve/templatekw.py Sat Mar 07 01:36:33 2020 +0700 +++ b/hgext3rd/evolve/templatekw.py Sat Mar 07 01:43:40 2020 +0700 @@ -22,36 +22,20 @@ ### template keywords -if util.safehasattr(templatekw, 'compatlist'): - @eh.templatekeyword(b'instabilities', requires={b'ctx', b'templ'}) - def showinstabilities(context, mapping): - """List of strings. Evolution instabilities affecting the changeset - (zero or more of "orphan", "content-divergent" or "phase-divergent").""" - ctx = context.resource(mapping, b'ctx') - return templatekw.compatlist(context, mapping, b'instability', - ctx.instabilities(), - plural=b'instabilities') +@eh.templatekeyword(b'instabilities', requires={b'ctx', b'templ'}) +def showinstabilities(context, mapping): + """List of strings. Evolution instabilities affecting the changeset + (zero or more of "orphan", "content-divergent" or "phase-divergent").""" + ctx = context.resource(mapping, b'ctx') + return templatekw.compatlist(context, mapping, b'instability', + ctx.instabilities(), + plural=b'instabilities') - @eh.templatekeyword(b'troubles', requires={b'ctx', b'templ'}) - def showtroubles(context, mapping): # legacy name for instabilities - ctx = context.resource(mapping, b'ctx') - return templatekw.compatlist(context, mapping, b'trouble', - ctx.instabilities(), plural=b'troubles') -else: - # older template API in hg < 4.6 - @eh.templatekeyword(b'instabilities') - def showinstabilities(**args): - """List of strings. Evolution instabilities affecting the changeset - (zero or more of "orphan", "content-divergent" or "phase-divergent").""" - ctx = args[b'ctx'] - return templatekw.showlist(b'instability', ctx.instabilities(), args, - plural=b'instabilities') - - @eh.templatekeyword(b'troubles') - def showtroubles(**args): - ctx = args[b'ctx'] - return templatekw.showlist(b'trouble', ctx.instabilities(), args, - plural=b'troubles') +@eh.templatekeyword(b'troubles', requires={b'ctx', b'templ'}) +def showtroubles(context, mapping): # legacy name for instabilities + ctx = context.resource(mapping, b'ctx') + return templatekw.compatlist(context, mapping, b'trouble', + ctx.instabilities(), plural=b'troubles') _sp = templatekw.showpredecessors if util.safehasattr(_sp, '_requires'):