templatekw: do not override in-core {obsolete} keyword stable
authorYuya Nishihara <yuya@tcha.org>
Wed, 08 Aug 2018 20:21:34 +0900
branchstable
changeset 3941 2b885ca5afcc
parent 3940 e69ff3ae758c
child 3942 38c9a050ba03
child 3947 5fade2cb9e00
templatekw: do not override in-core {obsolete} keyword The extension version uses old API, which will be deprecated in Mercurial 4.8.
hgext3rd/evolve/templatekw.py
--- a/hgext3rd/evolve/templatekw.py	Mon Aug 13 12:55:10 2018 +0200
+++ b/hgext3rd/evolve/templatekw.py	Wed Aug 08 20:21:34 2018 +0900
@@ -26,13 +26,15 @@
 ### template keywords
 # XXX it does not handle troubles well :-/
 
-@eh.templatekw('obsolete')
-def obsoletekw(repo, ctx, templ, **args):
-    """String. Whether the changeset is ``obsolete``.
-    """
-    if ctx.obsolete():
-        return 'obsolete'
-    return ''
+if not util.safehasattr(templatekw, 'showobsolete'):
+    # hg < 4.2
+    @eh.templatekw('obsolete')
+    def obsoletekw(repo, ctx, templ, **args):
+        """String. Whether the changeset is ``obsolete``.
+        """
+        if ctx.obsolete():
+            return 'obsolete'
+        return ''
 
 if util.safehasattr(templatekw, 'compatlist'):
     @eh.templatekw('troubles', requires=set(['ctx', 'templ']))