Mercurial > evolve
changeset 5184:2ccd7c97ed59
evolve: drop 4.5 compatibility for template keywords
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 07 Mar 2020 01:43:40 +0700 |
parents | 9ac6779d608c |
children | c111d5db3713 |
files | hgext3rd/evolve/templatekw.py |
diffstat | 1 files changed, 13 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- 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'):